Merge branch 'feature/enhance-logging' into 'master'

Feature/enhance logging

See merge request ungleich-public/dynamicweb!693
This commit is contained in:
pcoder116 2019-04-13 12:08:44 +02:00
commit d1d161ac49
2 changed files with 11 additions and 3 deletions

View file

@ -685,18 +685,26 @@ if ENABLE_LOGGING:
custom_handler_item = { custom_handler_item = {
'custom_file': { 'custom_file': {
'level': LOG_LEVEL, 'level': LOG_LEVEL,
'class': 'logging.FileHandler', 'class': 'logging.handlers.RotatingFileHandler',
'filename': 'filename':
"{PROJECT_DIR}/{LEVEL}.log".format( "{PROJECT_DIR}/logs/{LEVEL}.log".format(
LEVEL=LOG_LEVEL.lower(), LEVEL=LOG_LEVEL.lower(),
PROJECT_DIR=PROJECT_DIR PROJECT_DIR=PROJECT_DIR
) ),
'maxBytes': 1024 * 1024 * 5,
'backupCount': 10,
'formatter': 'standard',
} }
} }
handlers_dict.update(custom_handler_item) handlers_dict.update(custom_handler_item)
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
'disable_existing_loggers': False, 'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s %(levelname)s %(name)s: %(message)s'
}
},
'handlers': handlers_dict, 'handlers': handlers_dict,
'loggers': loggers_dict 'loggers': loggers_dict
} }

0
logs/.gitkeep Normal file
View file