Compare commits

...

1 commit

Author SHA1 Message Date
PCoder
8472bdd097 Add django error logger 2020-06-11 10:11:46 +05:30

View file

@ -684,6 +684,17 @@ if ENABLE_LOGGING:
} }
} }
loggers_dict.update(logger_item) loggers_dict.update(logger_item)
if not 'django' in MODULES_TO_LOG:
loggers_dict.update(
{
'django': {
'handlers': ['django_error'],
'level': 'ERROR',
'propagate': True
}
}
)
custom_handler_item = { custom_handler_item = {
'custom_file': { 'custom_file': {
@ -697,6 +708,18 @@ if ENABLE_LOGGING:
'maxBytes': 1024 * 1024 * 5, 'maxBytes': 1024 * 1024 * 5,
'backupCount': 10, 'backupCount': 10,
'formatter': 'standard', 'formatter': 'standard',
},
'django_error': {
'level': 'ERROR',
'class': 'logging.handlers.RotatingFileHandler',
'filename':
"{PROJECT_DIR}/logs/django-error.log".format(
LEVEL=LOG_LEVEL.lower(),
PROJECT_DIR=PROJECT_DIR
),
'maxBytes': 1024 * 1024 * 5,
'backupCount': 10,
'formatter': 'standard',
} }
} }
handlers_dict.update(custom_handler_item) handlers_dict.update(custom_handler_item)