Skip to content

Instantly share code, notes, and snippets.

@jfriedly
Last active December 14, 2015 19:48
Show Gist options
  • Save jfriedly/5138827 to your computer and use it in GitHub Desktop.
Save jfriedly/5138827 to your computer and use it in GitHub Desktop.
How to set the logging level to DEBUG in the Python interpreter without using basicConfig()
import logging
rootLogger = logging.getLogger()
rootLogger.setLevel(logging.DEBUG)
# Try logging.debug('foo') now!
#
# Note: if you have a module that uses a logger and you want it to log interactively, you'll need to
# import/reload it *after* running this code.
#
# This may also help:
consoleLogger = logging.StreamHandler()
consoleLogger.setLevel(logging.DEBUG)
rootLogger.addHandler(consoleLogger)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment