0

How do I dump the current configuration of the Python logging module? For example, if I use a module that configures logging for me, how can I see what it has done?

Share

    1 Answer 1

    0

    There does not appear to be a documented way to do so, but we can get hints by looking at how the logging module is implemented.

    All Loggers belong to a tree, with the root Logger instance at logging.root. The Logger instances do not track their own children but instead have a shared Manager that can be used to get a list of all loggers:

    >>> print(logging.root.manager.loggerDict) { 'rosgraph': <logging.PlaceHolder object at 0xffffa2851710>, 'rosgraph.network': <logging.Logger object at 0xffffa28517d0>, 'rosout': <rosgraph.roslogging.RospyLogger object at 0xffffa2526290>, 'rospy': <rosgraph.roslogging.RospyLogger object at 0xffffa2594250>, ... } 

    Each Logger instance has handlers and filters attributes which can help understand the behavior of the logger.

    Share

      Not the answer you're looking for? Browse other questions tagged or ask your own question.