简体   繁体   中英

How do I see which python loggers have been created by the logging module?

How can I obtain a list or dict of logging.Logger objects which have been created in the current Python process by the logging.getLogger() method?

Note: this already has an answer here , but I thought it would be easier to find on SO. Credit to the authors at that link.

You can retrieve a dict of loggers with logging.Logger.manager.LoggerDict .

This is a dict of the format:

{
    '<name passed in logging.getLogger(name) call>': <logging.Logger instance>,
    ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM