Skip to content

Commit

Permalink
#537 fixed server.log path, when started with --log-folder parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
bugy committed Oct 7, 2022
1 parent d35f2bb commit f07b621
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions conf/logging.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"file": {
"class": "logging.FileHandler",
"level": "INFO",
"formatter": "simple",
"filename": "logs/server.log"
"formatter": "simple"
}
},
"loggers": {
Expand Down
6 changes: 6 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ def main():
logging_conf_file = os.path.join(CONFIG_FOLDER, 'logging.json')
with open(logging_conf_file, 'rt') as f:
log_config = json.load(f)
handlers = log_config.get('handlers')
if handlers:
file_handler = handlers.get('file')
if file_handler:
file_handler['filename'] = os.path.join(LOG_FOLDER, 'server.log')

file_utils.prepare_folder(LOG_FOLDER)

logging.config.dictConfig(log_config)
Expand Down

0 comments on commit f07b621

Please sign in to comment.