Skip to content

Instantly share code, notes, and snippets.

@nnja
Created October 1, 2018 06:26
Show Gist options
  • Save nnja/e99a37727d23ce4346b2925ae75e7d7c to your computer and use it in GitHub Desktop.
Save nnja/e99a37727d23ce4346b2925ae75e7d7c to your computer and use it in GitHub Desktop.
Log every database query in django with DEBUG=True
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/path/to/django/debug.log',
},
},
'loggers': {
'django.db.backends': {
'handlers': ['file'],
'level': 'DEBUG',
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment