Skip to content

Instantly share code, notes, and snippets.

@markscottwright
Created August 23, 2018 17:45
Show Gist options
  • Save markscottwright/8b1090b6a8c989eae10bca15df6d2931 to your computer and use it in GitHub Desktop.
Save markscottwright/8b1090b6a8c989eae10bca15df6d2931 to your computer and use it in GitHub Desktop.
How to log SQL in Django Unit Tests
import logging
from django.conf import settings
logging.getLogger('django.db.backends').setLevel(logging.DEBUG)
logging.getLogger('django.db.backends').addHandler(logging.StreamHandler())
settings.DEBUG = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment