Opened 8 years ago

Closed 8 years ago

#14625 closed (wontfix)

Docs on logging should emphasize that file logging is not multiprocess save

Reported by: Piotr Czachur Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


python logging facility is not multiprocess save:

"Although logging is thread-safe, and logging to a single file from multiple threads in a single process is supported, logging to a single file from multiple processes is not supported [...]" (

"Not supported" means your logs from multiple process can mix in chunks due to buffering issues (I tested it for long messages ~5k - their chunks just got mixed)

Django popular deployment is mod_wsgi/multiprocess so it can be the issue.

Change History (2)

comment:1 Changed 8 years ago by Piotr Czachur

You may provide as alternative for RotatingFileHandler

comment:2 Changed 8 years ago by Gabriel Hurley

Resolution: wontfix
Status: newclosed

At present, Django's docs give no recommendation to use FileHandler (or RotatingFileHandler) at all. The docs instead direct people to the Python logging docs, which do cover the issue you raised, though not as loudly or obviously as might be desired.

I agree that logging to a file is a common practice, and that using RotatingFileHandler is a common practice, but I really see this as a failure of the Python documentation that the issue is not more clearly noted.

As such, I would say this ticket should be directed at the Python docs rather than the Django docs until such time as Django has specific recommendations or examples regarding specific file-logging configurations.

If you feel that Django's documentation *should* have recommended logging configurations that's a whole different issue, and will probably require building consensus on the Django Developers mailing list.

Note: See TracTickets for help on using tickets.
Back to Top