How to print current logging configuration used by the python logging module?

From Simeon’s comment, the logging_tree package lets you print out the details of the current logging configuration.

>>> import logging
>>> logging.getLogger('a')
>>> logging.getLogger('a.b').setLevel(logging.DEBUG)
>>> logging.getLogger('x.c')
>>> from logging_tree import printout
>>> printout()
<--""
   Level WARNING
   |
   o<--"a"
   |   Level NOTSET so inherits level WARNING
   |   |
   |   o<--"a.b"
   |       Level DEBUG
   |
   o<--[x]
       |
       o<--"x.c"
           Level NOTSET so inherits level WARNING
>>> # Get the same display as a string:
>>> from logging_tree.format import build_description
>>> print(build_description()[:50])
<--""
   Level WARNING
   |
   o<--"a"
   |   Leve

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)