I am a bit confused on how django is handling the logging. I have this setting for loggers in my settings:
Logging settings
LOGGING = {
...
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
'file': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': LOG_BASE_DIRECTORY + '/django.log',
'maxBytes': LOGFILE_SIZE,
'backupCount': LOGFILE_COUNT,
'formatter': 'verbose'
},
'mail_admins': {
'level': 'ERROR',
#'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django': {
'handlers': ['file','mail_admins'],
'level': 'INFO',
'propagate': True,
},
'app1': {
'handlers': ['file','mail_admins'],
'level': 'DEBUG',
'propagate': True,
},
...
},
}
As one can see, I have 2 handlers defined for django and app logs, file and mail_admins. The log level for file is debug. Hence I assume all logs which are debug and above shall use this handler. The level for mail_admins is error. The problem that I am seeing though is that in case of 500 errors while email handler runs and sends the mail there is no logging on the file.