You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am confident this is a bug in CPython,
not a bug in a third-party project
I have searched the CPython issue tracker,
and am confident this bug has not been reported before
A clear and concise description of the bug
After using basicConfig or dictConfig for a logger, handlers attribute would still be [] while hasHandlers equals True. Even though handlers is empty, StreamHandler still works and prints out log messages.
Checks to see if this logger has any handlers configured.
This is done by looking for handlers in this logger and its parents in the logger hierarchy.
Returns True if a handler was found, else False.
The method stops searching up the hierarchy whenever a logger with the ‘propagate’ attribute
set to false is found - that will be the last logger which is checked for the existence of handlers.
From this, it should be clear that the result of hasHandlers() for a logger is only partly determined by the contents of that logger's handlers attribute.
Before asserting that "I am confident this is a bug in CPython", please view the available documentation and perhaps ask on discuss.python.org, Stack Overflow etc. to confirm that others agree there's a problem there to be addressed.
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Checklist
not a bug in a third-party project
and am confident this bug has not been reported before
A clear and concise description of the bug
After using
basicConfig
ordictConfig
for a logger,handlers
attribute would still be[]
whilehasHandlers
equalsTrue
. Even thoughhandlers
is empty, StreamHandler still works and prints out log messages.Code:
Output:
Your environment
The text was updated successfully, but these errors were encountered: