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
1. Create and run app: `litestar --app asgi:app run`
2. `curl 0.0.0.0:8000`
3. See error
2024-04-23T22:43:18.589449Z [debug ] you shouldnt see this
INFO: 127.0.0.1:58488 - "GET / HTTP/1.1" 200 OK
Screenshots
No response
Logs
✗ litestar --app asgi:app run
Using Litestar app from env: 'asgi:app'
Starting server process ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌──────────────────────────────┬──────────────────────┐
│ Litestar version │ 2.8.2 │
│ Debug mode │ Disabled │
│ Python Debugger on exception │ Disabled │
│ CORS │ Disabled │
│ CSRF │ Disabled │
│ OpenAPI │ Enabled path=/schema │
│ Compression │ Disabled │
│ Middlewares │ LoggingMiddleware │
└──────────────────────────────┴──────────────────────┘
2024-04-23T22:43:18.589367Z [info ] HTTP Request method=GET path=/ path_params={} query={}
2024-04-23T22:43:18.589449Z [debug ] you shouldnt see this
INFO: 127.0.0.1:58488 - "GET / HTTP/1.1" 200 OK
2024-04-23T22:43:18.589767Z [info ] HTTP Response status_code=200
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:
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: