lofidevops
lofidevops

Reputation: 16962

Why are my Django / uWSGI vassal logs empty?

I am running my Django site as a vassal of UWSGI emperor. I have created /etc/uwsgi-emperor/vassals/mysite.ini as follows:

[uwsgi]
socket = /var/opt/mysite/uwsgi.sock
chmod-socket = 775
chdir = /opt/mysite
master = true
virtualenv = /opt/mysite_virtualenv
env = DJANGO_SETTINGS_MODULE=mysite.settings
module = mysite.wsgi:application
uid = www-data
gid = www-data
processes = 1
threads = 1
plugins = python3,logfile
logger = file:/var/log/uwsgi/app/mysite.log
vacuum = true

But /var/log/uwsgi/app/mysite.log does not get created. If I touch it, it remains empty. This occurs even after I trigger 500-style errors in the application.

Why aren't my logs being written?

Upvotes: 0

Views: 625

Answers (1)

lofidevops
lofidevops

Reputation: 16962

The vassal does not have permission to write to the file (or create the file in the first place). You should

cd /var/log/uwsgi/app
touch mysite.log # create the file
chown www-data:www-data mysite.log # give the vassal permission

(where www-data:www-data matches the uid and gid values in your ini file).

Logs will start appearing shortly.

Upvotes: 1

Related Questions