mirror of
https://github.com/certbot/certbot.git
synced 2026-06-05 06:42:10 -04:00
print logfile rather than logdir in exit handler
This commit is contained in:
parent
9153c894fb
commit
dd7811c492
3 changed files with 7 additions and 7 deletions
|
|
@ -98,7 +98,6 @@ def post_arg_parse_setup(config):
|
|||
"""
|
||||
file_handler, file_path = setup_log_file_handler(
|
||||
config, 'letsencrypt.log', FILE_FMT)
|
||||
logs_dir = os.path.dirname(file_path)
|
||||
|
||||
root_logger = logging.getLogger()
|
||||
memory_handler = stderr_handler = None
|
||||
|
|
@ -131,7 +130,7 @@ def post_arg_parse_setup(config):
|
|||
|
||||
sys.excepthook = functools.partial(
|
||||
post_arg_parse_except_hook,
|
||||
debug=config.debug, quiet=config.quiet, log_path=logs_dir)
|
||||
debug=config.debug, quiet=config.quiet, log_path=file_path)
|
||||
|
||||
|
||||
def setup_log_file_handler(config, logfile, fmt):
|
||||
|
|
@ -377,6 +376,6 @@ def exit_with_advice(log_path: str):
|
|||
if os.path.isdir(log_path):
|
||||
msg += f'logfiles in {log_path} '
|
||||
else:
|
||||
msg += f"logfile '{log_path}' "
|
||||
msg += f"logfile {log_path} "
|
||||
msg += 'or re-run Certbot with -v for more details.'
|
||||
sys.exit(msg)
|
||||
|
|
|
|||
|
|
@ -101,16 +101,17 @@ class PostArgParseSetupTest(test_util.ConfigTestCase):
|
|||
mock_sys.version_info = sys.version_info
|
||||
self._call(self.config)
|
||||
|
||||
log_path = os.path.join(self.config.logs_dir, 'letsencrypt.log')
|
||||
|
||||
self.root_logger.removeHandler.assert_called_once_with(
|
||||
self.memory_handler)
|
||||
self.assertTrue(self.root_logger.addHandler.called)
|
||||
self.assertTrue(os.path.exists(os.path.join(
|
||||
self.config.logs_dir, 'letsencrypt.log')))
|
||||
self.assertTrue(os.path.exists(log_path))
|
||||
self.assertFalse(os.path.exists(self.temp_path))
|
||||
mock_sys.excepthook(1, 2, 3)
|
||||
mock_except_hook.assert_called_once_with(
|
||||
1, 2, 3, debug=self.config.debug,
|
||||
quiet=self.config.quiet, log_path=self.config.logs_dir)
|
||||
quiet=self.config.quiet, log_path=log_path)
|
||||
|
||||
level = self.stream_handler.level
|
||||
if self.config.quiet:
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ def check_error(command, dir_path):
|
|||
report_failure("Certbot didn't exit with a nonzero status!", out, err)
|
||||
|
||||
# this regex looks weird in order to deal with a text change between HEAD and -oldest
|
||||
match = re.search("ee the logfile '(.*)' ", err)
|
||||
match = re.search("ee the logfile '?(.*?)'? ", err)
|
||||
if match is not None:
|
||||
# Get error output from more verbose logfile
|
||||
with open(match.group(1)) as f:
|
||||
|
|
|
|||
Loading…
Reference in a new issue