django & gunicorn: KeyError with active log-config setting

235 views
Skip to first unread message

Florian Auer

unread,
Nov 13, 2014, 7:35:40 AM11/13/14
to django...@googlegroups.com
Hi

I wanted to let my gunicorn server to log its config into a dedicated file.
Therefore I added an extra line:
exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=debug \
--bind=unix:$SOCKFILE \
--log-file=$ERRLOG \
--access-logfile=$LOGFILE \
--log-config=$CONFLOG # added this line with the \ before

But when i start the server with supervisorctl i receive a "KeyError" for the formatters.
Traceback (most recent call last):
 
File "/webapps/sonar3/tekkoSONAR/../bin/gunicorn", line 11, in <module>
    sys
.exit(run())
 
File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
   
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
 
File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/base.py", line 185, in run
   
super(Application, self).run()
 
File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/app/base.py", line 71, in run
   
Arbiter(self).run()
 
File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/arbiter.py", line 57, in __init__
   
self.setup(app)
 
File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/arbiter.py", line 88, in setup
   
self.log = self.cfg.logger_class(app.cfg)
 
File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/glogging.py", line 175, in __init__
   
self.setup(cfg)
 
File "/webapps/sonar3/lib/python3.3/site-packages/gunicorn/glogging.py", line 203, in setup
    disable_existing_loggers
=False)
 
File "/usr/local/lib/python3.3/logging/config.py", line 70, in fileConfig
    formatters
= _create_formatters(cp)
 
File "/usr/local/lib/python3.3/logging/config.py", line 103, in _create_formatters
    flist
= cp["formatters"]["keys"]
 
File "/usr/local/lib/python3.3/configparser.py", line 937, in __getitem__
   
raise KeyError(key)
KeyError: 'formatters'
- log file exists
- permissions math
Keeping the --log-config out of the command, everything start correctly.

Any help / idea welcome

Collin Anderson

unread,
Nov 17, 2014, 3:31:27 PM11/17/14
to django...@googlegroups.com
Hello,

You may want to try asking this on the gunicorn mailing list if you haven't.

Thanks,
Collin
Reply all
Reply to author
Forward
0 new messages