From 8acc67b0ceac35fbfac7a1d20469412a0b25ea1e Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Thu, 17 Oct 2019 10:21:55 +0200 Subject: [PATCH] Fixed RotatingFileHandler permission error (for Docker Toolbox on Windows) (#614) --- CHANGELOG-0.4.md | 1 + core/src/epicli/cli/helpers/Log.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG-0.4.md b/CHANGELOG-0.4.md index a47bb73b1f..2a46929ba4 100644 --- a/CHANGELOG-0.4.md +++ b/CHANGELOG-0.4.md @@ -5,6 +5,7 @@ ### Fixed - [#613](https://github.com/epiphany-platform/epiphany/pull/613) - Hotfixes for Ubuntu offline installation in air-gap mode +- [#614](https://github.com/epiphany-platform/epiphany/pull/614) - Fixed RotatingFileHandler permission error (for Docker Toolbox on Windows) ## [0.4.0] 2019-10-11 diff --git a/core/src/epicli/cli/helpers/Log.py b/core/src/epicli/cli/helpers/Log.py index fd3bb008f7..89440cb1d4 100644 --- a/core/src/epicli/cli/helpers/Log.py +++ b/core/src/epicli/cli/helpers/Log.py @@ -17,14 +17,14 @@ def __init__(self): log_path = os.path.join(get_output_path(), config.log_file) logging.basicConfig(level=logging.INFO, format=config.log_format, datefmt=config.log_date_format) formatter = jsonlogger.JsonFormatter(config.log_format, datefmt=config.log_date_format) - self.json_file_handler = logging.FileHandler(filename=log_path) - self.json_file_handler.setFormatter(formatter) - self.json_stream_handler = logging.StreamHandler() - self.json_stream_handler.setFormatter(formatter) should_roll_over = os.path.isfile(log_path) - handler = logging.handlers.RotatingFileHandler(log_path, mode='w', backupCount=config.log_count) + handler = logging.handlers.RotatingFileHandler(log_path, backupCount=config.log_count) if should_roll_over: handler.doRollover() + self.json_file_handler = handler + self.json_file_handler.setFormatter(formatter) + self.json_stream_handler = logging.StreamHandler() + self.json_stream_handler.setFormatter(formatter) instance = None