FastAPI Uvicorn logging in Production

Hello 🙋‍♂️, Running a ⏩FastAPI ⏩ application in production is very easy and fast, but along the way some Uvicorn logs are lost. In this article I will discuss how to write a custom UvicornWorker and to centralize your logging configuration into a single file. To keep things as simple as possible I’ve put all my code in a single Python file. main.py import uvicorn as uvicorn from fastapi import FastAPI, APIRouter router = APIRouter(prefix="") def create_app(): fast_app = FastAPI() fast_app....

May 18, 2021 · 3 min · Denis Nuțiu