mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
simplify log file error handling
This commit is contained in:
parent
40449ed274
commit
9ae755ef4c
1 changed files with 2 additions and 8 deletions
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import print_function
|
||||
import atexit
|
||||
import dialog
|
||||
import errno
|
||||
import functools
|
||||
import logging.handlers
|
||||
import os
|
||||
|
|
@ -602,13 +601,8 @@ def setup_log_file_handler(config, logfile, fmt):
|
|||
try:
|
||||
handler = logging.handlers.RotatingFileHandler(
|
||||
log_file_path, maxBytes=2 ** 20, backupCount=10)
|
||||
except IOError as e:
|
||||
if e.errno == errno.EACCES:
|
||||
msg = ("Access denied writing to {0}. To run as non-root, set " +
|
||||
"--logs-dir, --config-dir, --work-dir to writable paths.")
|
||||
raise errors.Error(msg.format(log_file_path))
|
||||
else:
|
||||
raise
|
||||
except IOError:
|
||||
raise errors.Error(_PERM_ERR_FMT.format(log_file_path))
|
||||
# rotate on each invocation, rollover only possible when maxBytes
|
||||
# is nonzero and backupCount is nonzero, so we set maxBytes as big
|
||||
# as possible not to overrun in single CLI invocation (1MB).
|
||||
|
|
|
|||
Loading…
Reference in a new issue