How to print current logging configuration used by the python logging module?
Question: I'm using the python logging module.

I update the logging config using logging.dictConfig().

I would like a way to read the current configuration (e.g. level) used by each
logger and print it.

How can I get and print this information?


Answer: If what you want is the logging level for a particular logger, then you can
use -
[`logger.getEffectiveLevel()`](https://docs.python.org/2/library/logging.html#logging.Logger.getEffectiveLevel)
, this would give the integer value for the currently logging level for the
logger, and then you can use it with
[`logging.getLevelName()`](https://docs.python.org/2/library/logging.html#logging.getLevelName)
, to get the string representation for that level.

Example -

    
    
    >>> import logging
    >>> l = logging.getLogger(__name__)
    >>> l.setLevel(logging.DEBUG)
    >>> logging.getLevelName(l.getEffectiveLevel())
    'DEBUG'
    

