!!! note This post is a thought. It's a short note that I make about someone else's content online. Learn more about the process here

Here's my thought on 馃挱 logs with FastAPI and Uvicorn 路 Issue #1508 路 tiangolo/fastapi


Setting an additional log handler to the uvicorn logger for access logs in fastapi was not straightforward, but This post was very helpful.


@app.on_event("startup")
async def startup_event():
    logger = logging.getLogger("uvicorn.access")
    handler = logging.StreamHandler()
    handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(message)s"))
    logger.addHandler(handler)

This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts