13

My Situation
There may be one or more configured loggers, but I don't know what their names are.

Requirement
For testing purposes, I need to reconfigure logging handlers that were previously configured to log to stdout with a different format and logging level.

  1. [caveat] I already know how to clear one handler.
  2. [caveat] I would prefer stdlib over 3rd-party libs (pypi, github, et al).

1 Answer 1

17
print (logging.Logger.manager.loggerDict.keys())

found by digging the sources of logging package

Sign up to request clarification or add additional context in comments.

3 Comments

LOL. I was totally going to answer my own question with the same thing. Thanks.
I think that dict does not include root logger handlers
Excellent, thank you. I still haven't found a simpler way to do it than this.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.