79509221

Date: 2025-03-14 13:40:58
Score: 1
Natty:
Report link

The initial code is valid, but you selected the wrong logger. To get the traceback on the error, you would need to modify the "uvicorn.error" logger.

Like so:

 import logging
 log = logging.getLogger("uvicorn.error")
 log.setLevel(logging.DEBUG)

Other available default loggers are "uvicorn" and "uvicorn.access" , as seen in @TheClockTwsiter's answer. This way you don't need to copy/modify the entire logging configuration. It will also preserve any implicit behavior of the uvicorn logging configuration, if it is ever updated by the dev team.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @TheClockTwsiter's
  • Low reputation (1):
Posted by: PatJon6