-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Lower the root logger's log level to --log-level instead of to NOTSET #3027
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
Conversation
I agree. 😓 It seems the tests are now failing... @segevfiner if you have the time can you perhaps take a look? |
@@ -242,6 +242,8 @@ def __init__(self, config): | |||
The formatter can be safely shared across all handlers so | |||
create a single one for the entire test session here. | |||
""" | |||
self.log_level = get_actual_log_level( | |||
config, 'log_level') or logging.WARNING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might consider to use None
as default; then if None
, we don't touch the log level at all all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that if you pass None
to logger.setLevel
or handler.setLevel
a TypeError is raised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, but actually I meant to check for None
before calling setLevel
.
The failing tests (There might be other failures too) show why the root logger was probably set to
I guess that means that simply not setting the root logger's log level won't be enough since I think the module is currently expected to catch all logs by default. That's what I get for underestimating |
Thanks anyway @segevfiner, this certaily helped to shed some more light in the subtle details involved. We continue the discussion about logging in general in #3013. |
logging
is a seriously confusing module, I'm not really sure that's the right way to fix this, so review with care.Fixes #2977
Checklist
Thanks for submitting a PR, your contribution is really appreciated!
Here's a quick checklist that should be present in PRs:
$issue_id.$type
for example (588.bugfix)removal
,feature
,bugfix
,vendor
,doc
ortrivial
bugfix
,vendor
,doc
ortrivial
fixes, targetmaster
; for removals or features targetfeatures
;Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please:
AUTHORS
, in alphabetical order;