Chained exceptions truncated when log level is set to TRACE #2326
Unanswered
zhixing0
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We find that when log level is set to trace, chained & unhandled exceptions (that reach uvicorn) will be truncated to the last exception. Below is a minimal reproduction script:
Accessing http://127.0.0.1:8080 will trigger the exception, but only E2 will appear in the log.
In contrast, setting log_level to anything higher than trace (e.g. info) produces a complete trace with both E1 and E2.
The cause seems to be this
MessageLoggerMiddleware
introduced here when level is trace or below (line link).Inside the middleware, a
raise exc from None
statement drops any chained trace (line link).Is there any rationale behind this, or is it a bug?
FastAPI version: 0.111.0
uvicorn version: 0.29.0
Beta Was this translation helpful? Give feedback.
All reactions