benoitc/gunicorn — Issue #309: Logging fails when gunicorn daemon mode and django loggers are used
Author: pigletto
Created: 2012-03-08 23:23:24+00:00
State: open

When gunicorn is run in daemon mode, with configured access and error loggers, and Django also sets some loggers in its settings.py then gunicorn logs are written incorrectly.
Access log file remains empty and entries that should be written to it are written to error log file. Also, an exception from glogger.py is raised:

Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 866, in emit
self.flush()
File "/usr/lib/python2.7/logging/__init__.py", line 828, in flush
self.stream.flush()
IOError: [Errno 9] Bad file descriptor
Logged from file glogging.py, line 189

Without daemon mode everything seems to work properly.

I've created simple django application that exposes the problem (uses buildout so can be run with four commands).
Take at it to reproduce the issue:

https://github.com/pigletto/gunicorn_test

In general I found this issue to be similar/same as: https://github.com/benoitc/gunicorn/issues/155