How to use Django writing with a gun

I have a Django 1.6 gun site managed by a supervisor. During tests and runerver, I register the console, but with gunicorn, claims are not displayed anywhere (even ERROR level logs). They should be in / var / log / supervisor / foo -stderr --- supervisor-51QcIl.log, but it is not. I have a celery running on another machine using a supervisor, and its debug statements are displayed in the supervisor error file.

Edit: Performing a foreground shoot shows that none of my error messages are logged in stderr, as when running manage.py. This is definitely a gun issue, not a supervisor problem.

+6
source share
3 answers

I got a response on GitHub:

https://github.com/benoitc/gunicorn/issues/708

Since you passed disable_existing_loggers, Gunicorn loggers are disabled when Django loads your logging configuration. If you configured this because you want to disable the default Django logging configuration, be sure to add the gunicorn, gunicorn.error, and gunicorn.access recorders back with any handlers you want.

+4
source

In /etc/supervisor/conf.d/your-app.conf you should set the log paths:

 stdout_logfile=/var/log/your-app.log stderr_logfile=/var/log/your-app.log 
+2
source

Firstly, in your dispatcher’s configuration for the gun-arrow script, be sure to define

 stdout_logfile=/path/to/logfile.log redirect_stderr=true 

This will cause stdout and stderr to go to the same file.
Now, on your machine gun script, be sure to call the process with the following argument

 gunicorn YourWSGIModule:app --log-level=critical 
0
source

All Articles