Reputation: 4170
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.
Upvotes: 0
Views: 394
Reputation: 4858
I think you've miss understand the use of django.request
. Based on the doc
Log messages related to the handling of requests. 5XX responses are raised as ERROR messages; 4XX responses are raised as WARNING messages.
I think the django.request
only log info when 5XX or 4XX happened.
You can try http://127.0.0.1:8000/no/where/
to see if the logger worked.
Upvotes: 1
Reputation: 1
Check your DEBUG=True
in settings.py
require_debug_true
filter will only pass on records when settings.DEBUG is True.
See Django Logging
Upvotes: 0