Skip to main content

Debugging Python Logging Configurations

The Python logging facility is great, though I must sheepishly admit that, from time to time, I haven't a clue as to why it behaves as it does. There are so many ways to configure things, I find myself scratching my as as to why something does or doesn't work.

During a Satchmo project, I ran across Django management command lsloggers, which dumped the entire tree of python loggers in a nice ascii graphical format. The output leaves no question as to what is going on and why. It is highly recommended.

To check a Satchmo/Django logging configuration, run the command lsloggers, and you'll get the info you need.

If you have a standalone Satchmo/Django application (such as a test suite for a portion of code), you can add the following to your code to get a dump of the logging configuration:

from logging_tree import printout
print printout()

I have also since found that the author has made it available for non-Django pure Python applications. It is available on PyPi and via pip.

Another good site for general logging information: