Gunicorn logging from multiple workers

被刻印的时光 ゝ 提交于 2020-01-13 02:44:10

问题


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


回答1:


i use ConcurrentRotatingFileHandler




回答2:


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.



来源:https://stackoverflow.com/questions/14172470/gunicorn-logging-from-multiple-workers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!