The logging problem in Uvicorn was actually solved in a recent PR, but it hasn't been released yet (I wish I had noticed that before debugging the whole thing ).
Once they merge my PR with the new release (https://github.com/encode/uvicorn/pull/705), and actually release a new version, it should work properly.
A funny detail I noticed, the problem only shows up calling Uvicorn from Python as with uvicorn.run()
, it doesn't show up calling Uvicorn from the command line. That detail doesn't help here, but now I see why I wasn't seeing the problem before.