Colin Kroll
Colin Kroll

Reputation: 133

Gunicorn logging from multiple workers

I have a flask app that runs in multiple gunicorn sync processes on a server and uses TimedRotatingFileHandler to log to a file from within the flask application in each worker. In retrospect this seems unsafe. Is there a standard way to accomplish this in python (at high volume) without writing my own socket based logging server or similar? How do other people accomplish this? We do use syslog to aggregate across servers to a logging server already but I'd ideally like to persist the log on the app node first.

Thanks for your insights

Upvotes: 9

Views: 4092

Answers (2)

archer
archer

Reputation: 29

i use ConcurrentRotatingFileHandler

Upvotes: 2

Colin Kroll
Colin Kroll

Reputation: 133

We ended up changing our application to send logs to stdout and now rely on supervisord to aggregate the logs and write them to a file. We also considered sending logs directly to rsyslog but for now this is working well for us.

Upvotes: 1

Related Questions