I can't get logging to work in my Django web app.
My settings file looks like this:
EMAIL_HOST = "smtp.gmail.com"
EMAIL_PORT = 465
EMAIL_HOST_USER = "paulhtremblay@gmail.com"
EMAIL_HOST_PASSWORD = "password"
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = "paulhtremblay@gmail.com"
SERVER_EMAIL = 'smtp.gmail.com'
ADMINS = (
('Paul Tremblay', 'paulhtremblay@gmail.com'),
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'ERROR',
'class': 'logging.FileHandler',
'filename': '/var/log/django_logs/debug.log'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'ERROR',
'propagate': True,
},
'django.request': {
'handlers': ['file'],
'level': 'ERROR',
'propagate': True,
},
},
}
I have this in my views file:
def five_hundred_test(request):
raise ValueError("raising this on purpose for testing for 500")
return render(request, 'my_test/basic_css.html')
When I point my browser to this function, I get a 500 Error (as expected), but nothing gets sent to my email, and nothing gets put in the log file. I am using Django 1.9, with python3, using Apache to run the server.