This is a glossary of all the common issues in Tiangolo Uvicorn-Gunicorn-FastAPI-Docker
  • 26-Dec-2022
Lightrun Team
Author Lightrun Team
This is a glossary of all the common issues in Tiangolo Uvicorn-Gunicorn-FastAPI-Docker

Troubleshooting Common Issues in Tiangolo Uvicorn-Gunicorn-FastAPI-Docker

Lightrun Team
Lightrun Team

Project Description


Tiangolo Uvicorn-Gunicorn is a pre-configured setup for running web applications using the Uvicorn web server and the Gunicorn application server. Uvicorn is a high-performance, pure-Python HTTP server based on the HTTP protocol specification, and Gunicorn is a Python WSGI HTTP Server for UNIX.

Tiangolo Uvicorn-Gunicorn is intended to be used as a production-ready web server for deploying Python web applications, such as those built with the FastAPI web framework. It is designed to be lightweight and efficient, with the goal of being able to handle high loads with minimal overhead.

To use Tiangolo Uvicorn-Gunicorn, you will need to install it in your Python environment and then specify it as the server when you deploy your application. You can then start the server using a command-line interface, and your application will be available at a specified URL.


Troubleshooting Tiangolo Uvicorn-Gunicorn-FastAPI-Docker with the Lightrun Developer Observability Platform


Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.
  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

The most common issues for Tiangolo Uvicorn-Gunicorn-FastAPI-Docker are:


How to do logging in a FastApi container, any logging does not appear


After much hard work and dedication, success was eventually found! To make it possible to access HTTP request info when running unicorn through gunicorn making just a few minor adjustments is all that’s needed. Append the corresponding snippet to your file; then everything will be ready for use!

import logging
from fastapi.logger import logger as fastapi_logger

gunicorn_error_logger = logging.getLogger("gunicorn.error")
gunicorn_logger = logging.getLogger("gunicorn")
uvicorn_access_logger = logging.getLogger("uvicorn.access")
uvicorn_access_logger.handlers = gunicorn_error_logger.handlers

fastapi_logger.handlers = gunicorn_error_logger.handlers

if __name__ != "__main__":

It has been established that our gunicorn.error logger can now handle uvicorn.access information from HTTP requests with no extra effort!


More issues from Tiangolo repos


Troubleshooting Tiangolo FastAPI | Troubleshooting Tiangolo Full Stack FastAPI and PostgreSQL | Troubleshooting Tiangolo Flask uWSGI Nginx with Docker


It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications. It’s a registration form away.

Get Lightrun

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.