Tuesday, 20 August 2013

supervisor with gunicorn and no logging

supervisor with gunicorn and no logging

I am trying to run a small WSGI application with gunicorn + supervisor and
although everything works correctly, I am unable to get logging to go to a
file.
If I run the gunicorn command directly, it does work however, sending all
the output to the file I am specifying, but as soon as I try the same
thing with supervisor it doesn't.
I recently moved this small WSGI app from uwsgi to gunicorn, and I had no
issues with uwsgi logging to a file, so I suspect I am either missing
something that gunicorn needs when working with supervisor or there is a
problem that is non-obvious to me.
The app is called upload and this is how the supervisor config for that
app looks like:
[program:upload]
command=/vagrant/venv/bin/gunicorn -w 4 upload.wsgi:application --log-file
/vagrant/log/application.log --log-level debug
directory=/vagrant
autostart=true
autorestart=true
The file /vagrant/log/application.log never gets any input. If I run the
above command directly it does, with the normal gunicorn info about
booting up workers:
2013-08-20 14:01:24 [1898] [INFO] Starting gunicorn 17.5
2013-08-20 14:01:24 [1898] [DEBUG] Arbiter booted
2013-08-20 14:01:24 [1898] [INFO] Listening at: http://127.0.0.1:8000 (1898)
2013-08-20 14:01:25 [1898] [INFO] Using worker: sync
2013-08-20 14:01:25 [1903] [INFO] Booting worker with pid: 1903
...
I've also attempted to use redirect_stderr in the supervisor config but
that also did make the log file to get any info.
Is this a known problem? Or do I need some other flag? (Note the app is
using gevent, not sure if that is relevant to this problem)

No comments:

Post a Comment