-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
Bug: StructlogPlugin loggers do not adhere to set log level #3424
Comments
If i blanketly set it works, so maybe something with import logging
import structlog
structlog.configure(
wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
) |
Issue is that the logs emitted via structlog's loggers don't pass through the standard library logging. This is why they aren't filtered by the level set on the root logger object, they are getting emitted directly to stdout via structlog. As @JacobCoffee noted above, this can be addressed by: StructLoggingConfig(wrapper_class=structlog.make_filtering_bound_logger(logging.INFO), ...) This gives structlog the information it needs to be able to filter the logs it emits. A positive for this approach is that it can be quite a bit more efficient. Some downsides are that the logs are going through a different processor chain than the standard library ones (our default chains are different for either case), and logs aren't using the queue listener/handler configuration (is that an issue?). |
Description
The expectation is that any logging done is derivative of the root logger if not otherwise specified.
Perhaps I've done this wrong - but I don't want to see debug level logs when I have set the level to
INFO
/20
or above.URL to code causing the issue
No response
MCVE
Steps to reproduce
Screenshots
No response
Logs
Litestar Version
main
Platform
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: