I'm got the following logging config -
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/home/svc_itamapi_dev/itam/logs/debug.log',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler'
},
},
'filters': {
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
},
},
'loggers': {
'django.request': {
'handlers': ['file', 'console'],
'filters': ['require_debug_true'],
'level': 'DEBUG',
'propagate': True,
},
},
}
When I hit my api I see the following on the console -
[02/Dec/2015 02:27:01] "GET /api/applications/?name=zabbix HTTP/1.1" 200 8232
But it's not generating it in my log file.
Copyright Notice:Content Author:「whoisearth」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/34033862/django-outputting-console-to-log-file