-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: matplotlib.set_loglevel() adds a console handler #23646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes agreed. But set_loglevel is meant to be a helper for endusers (eg our application) versus for downstream applications. Set matplotlibs log levels using the logging library if you have a downstream application. |
|
A link to the standard logging library would make sense. I don't really see the point of a deprecation cycle for the top-level set_loglevel - it is already also exposed as |
fair, will open a PR to fix that. I'm also thinking about adding a keyword arguement to opt-opt of us trying to install a handler.
We have not articulated in so many words, but this seems right. Historically the distinction has been a bit fuzzy, but we are slowly pushing things towards this state. |
xref #23681 (comment) |
Bug summary
matplotlib.set_loglevel() adds a
logging
console handler which then leads to duplicate messages in application code. The best practice is to allow the application code to add the handlers to its logger along with formatting, filtering, etc. The existing #13264 attempted to address this.Code for reproduction
Actual outcome
True
DEBUG:matplotlib:CACHEDIR=C:\Users\ljohnsto.matplotlib
CACHEDIR=C:\Users\ljohnsto.matplotlib
DEBUG:matplotlib.font_manager:Using fontManager instance from C:\Users\ljohnsto.matplotlib\fontlist-v330.json
Using fontManager instance from C:\Users\ljohnsto.matplotlib\fontlist-v330.json
Expected outcome
False
CACHEDIR=C:\Users\ljohnsto.matplotlib
Using fontManager instance from C:\Users\ljohnsto.matplotlib\fontlist-v330.json
Additional information
The workaround is:
The text was updated successfully, but these errors were encountered: