How to let Gunicorn log to console (stdout and stderr)

In a cloud app, it's better to:

  • output information logs to stdout
  • output error logs to stderr

This article will tell you how to make Gunicorn do this.

Update command line arguments

gunicorn --access-logfile '-' --error-logfile '-' app:app

Update config file

If you prefer to use the config file, try this:

gunicorn -c config.py app:app

The file config.py should contain:

accesslog = '-'
errorlog = '-'
Posted on 2023-03-08