How to enable uWSGI logging to a file?

The accepted answer did not work for me (possibly because it is 4 years old). Nginx running uwsgi 2.0.17.1 in a virtual env with circus controlling the workers. This did work though:

req-logger = file:/var/log/uwsgi/app/cart-req.log
logger = file:/var/log/uwsgi/app/cart-err.log

Not sure if it was necessary, but I

$ chown -R www-data:www-data /var/log/uwsgi/app

ref: https://uwsgi-docs.readthedocs.io/en/latest/Logging.html

as uwsgi runs as www-data


The "common" syntax is "logto = file".

The logger option is used for advanced plugins, if you want to use the 'file' one you have to load the logfile plugin (like you load the python one). But honestly if you only want to log to a file, logto will be more than enough

Tags:

Logging

Ini

Uwsgi