I want to log insert, update, delete and failed select query in my daily log file. I configured django.db.backends
in the logger of the Logging dict in settings.py
. But I get all the queries in that application. I need only insert, update, delete and failed select queries.
Try to add this to you settings.py
.
LOGGING = {
'version': 1,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/path/to/django/debug.log',
},
},
'loggers': {
'django.db.backends': {
'handlers': ['file'],
'level': 'DEBUG',
},
},
}
The documentation may help you and this article too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With