-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Pytest 3.3: root logger has wrong logging level #2977
Comments
Thanks @noahl |
The cause I think is _pytest/logging.py:289:290. You are calling What should the log level for the root logger be? Should it be |
Hmmm feels clumsy at first sight, I would expect it to not change the log level at all if not passed explicitly (but I have little experience with
Again I'm not expert, but that seems reasonable. |
@nicoddemus I ran into this problem as well. It seems when the I was seeing |
Summarizing from #3027. The way—I think—logging works when you write a message to a
The log capture module adds a log handler ( To be able to catch all log messages without this would probably require some really |
Hi guys, I believe this is related. For some reason I am just getting all logging levels (DEBUG onwards), and the --log-cli-level option has no effect at all on this. I added some prints inside my test functions and I am always getting level NOTSET for the root logger. |
@segevfiner your explanation makes sense, but if what you're saying is true, then I think the root logger should default to level |
This will be fixed by #3124. |
Is there any chance we can get the fix that prevents pytest from resetting the root logger's level backported to 3.3? At the moment pytest 3.3 is completely unusable because the libraries I depend have such verbose logging, and I have no way to filter it with pytest resetting the root logger for every test. |
Because this changes the defaults we can't include that in a bug-fix release, I'm afraid; but fear not, I plan to release 3.4 soon, probably next week. |
Thanks for the prompt response :). |
Sure! 👍 |
In Pytest 3.3, the following test case fails:
It passes in Pytest 3.2. The Python documentation (https://docs.python.org/3.6/library/logging.html#logging.Logger.setLevel) says that the root logger is created with level WARNING, so I believe this is a bug in pytest.
I think this is likely related to #2974 .
The text was updated successfully, but these errors were encountered: