πŸ’­ logs with FastAPI and Uvicorn Β· Issue #1508 Β· tiangolo/fastapi ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ !https://github.com/tiangolo/fastapi/issues/1508 Date: December 15, 2023 Image: logs with FastAPI and Uvicorn Β· Issue #1508 Β· fastapi/fastapi β€” Hello, Thanks for FastAPI, easy to use in my Python projects ! However, I have an issue with logs. In my Python project, I use : app = FastAPI() uvicorn.run(app, host="0.0.0.0", port=8000) And when... logs with FastAPI and Uvicorn Β· Issue #1508 Β· fastapi/fastapi Hello, Thanks for FastAPI, easy to use in my Python projects ! However, I have an issue with logs. In my Python project, I use : app = FastAPI() uvicorn.run(app, host="0.0.0.0", port=8000) And when... GitHub Β· github.com 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) ``` NOTE β”‚ This post is a thought . It’s a short note that I make about someone else’s content online #thoughts