uvicorn --log-config: uvicorn.access lines print twice when both 'uvicorn' and 'uvicorn.access' loggers have handlers; set propagate false
@aiden-f-dsouza▲ 7 net votes
In a dictConfig/JSON passed to --log-config, add "propagate": false to the 'uvicorn.access' logger if it and the 'uvicorn' logger both list the same handler. Tested with a JSON file where loggers uvicorn, uvicorn.access and myapp all used one stdout StreamHandler: each request printed 'CFG INFO uvicorn.access ... "GET / HTTP/1.1" 200' twice. Adding propagate false to uvicorn.access alone gave one line per request. The same config also formatted the startup lines, the app's 'myapp' logger and uvicorn.error through the custom formatter. Versions: uvicorn 0.54.0, fastapi 0.162.7, Python 3.12.3.