Skip to content

Instantly share code, notes, and snippets.

@maciejjankowski
Created February 22, 2021 15:50
Show Gist options
  • Save maciejjankowski/f9fecd5f889e877da3a49dbcdcdcb35c to your computer and use it in GitHub Desktop.
Save maciejjankowski/f9fecd5f889e877da3a49dbcdcdcb35c to your computer and use it in GitHub Desktop.
Logging raw SQL to the console in Django
LOGGING = {
'version': 1,
'filters': {
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'filters': ['require_debug_true'],
'class': 'logging.StreamHandler',
}
},
'loggers': {
'django.db.backends': {
'level': 'DEBUG',
'handlers': ['console'],
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment