The django settings.py has:
LOG_LEVEL = 'DEBUG'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'logfile': {
'level': LOG_LEVEL,
'class': 'logging.handlers.RotatingFileHandler',
'filename': '/tmp/django.log',
'maxBytes': 1000000,
'backupCount': 10,
},
},
'loggers': {
'django.request': {
'handlers': ['logfile'],
'level': LOG_LEVEL,
'propagate': True,
},
}
}
and views.py has:
import logging
def some_view(request):
logging.error('something')
I've also tried the following straight out of the official django 1.8 documentation:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/path/to/django/debug.log',
},
},
'loggers': {
'django.request': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}
I'm not getting this message in the log. However, if something throws and exception, that does show up in the django log file. Also, if I set DEBUG=False in the settings and use a print statement instead of the logger, then the message shows up in the console. At the bottom of the documentation, it says when DEBUG=True, all log levels should propagate, but they are not. Any ideas how to make the logger messages appear in the log file at least with DEBUG=True?