简体   繁体   中英

Django logging in file with Gunicorn and Upstart

I'm trying to get logs from Django app. in setting.py something like this:

   'handlers': {
         'file': {
             'level': 'DEBUG',
             'class': 'logging.FileHandler',
             'filename': 'elections_app/static/e.log',

When I running django with gunicorn manually, all work fine, log writed in file.

/root/elections/venv/bin/gunicorn elections.wsgi:application

But when i trying to use Upstart, to autostart etc., log is not writing. Log files created as they should, i can read them, but they are empty. Django site working as expected, problem only with log files.

Upstart script (CentOs6):

description "elections django app"

start on runlevel [2345] stop on runlevel [016]

respawn

chdir /root/elections

exec /root/elections/venv/bin/gunicorn elections.wsgi:application --bind XXX:80 --timeout 20000 --log-file /root/gunicorn.log --workers 4

What im doing wrong?

Looks like the process doesn't have permission to write the log file. Make sure the upstart process is allowed to write the log file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM