Last active
December 14, 2015 19:48
-
-
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()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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