Hi all,
I can't find anything that explicitly states Django handles this already (in the code or documentation) and I believe it to be a problem in the platform I am working on. Justification for this belief is loose at best, but it's the best lead I have (specifically, the SysLogHandler seems like it might be blocking on sending to a UDP port, which seems crazy but apparently is possible)
I'm setting trying to see if I can solve this, but there seems to be very little details on this subject, and that alone worries me. So I have a couple questions for anyone willing to entertain me:
- Is it silly to be worried about this? My gut says yes, simply because nobody else is. At the same time I see no real downside to logging asynchronously (is that true?). There are potential upsides. It might not solve the real problem (what is causing buffers to back up in the first place? likely crazy I/O usage) but it might speed up handling of requests during heavy I/O.
- Have you done anything similar to this? How did you approach it?
- The QueueHandler suggested in the Python cookbook doesn't seem to be easy to stuff into Django. We have Django running behind Gunicorn, so my thought was to have Gunicorn spin up a QueueListener process, and then have Gunicorn pass the queue to each worker similar to this cookbook: https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes -- I'm interested on any thoughts on this approach. Especially if there is a better way.
Cheers,
Dan