How to logging with timed rotate file handler in Tornado?

给你一囗甜甜゛ 提交于 2019-12-11 20:33:43

问题


I've asked a question (how to manage nohup.out file in Tornado) about how to handle nohup.out file automatically when running a Tornado web service.

And I decided to use the logging module of Tornado to write my log files. I read about the documents of Tornado. The logging module it provides doesn't have the TimedRotatingFileHandler, I still cannot manage the logging files as dates.

So I want to know how to use TimedRotatingFileHandler in the logging module of Tonado?


回答1:


I have rotating log files with my Tornado install.

I add this logging config line at the Tornado app startup:

logging.config.dictConfig(yaml.load(open('logging.yaml', 'r')))

and then include a logging.yaml that looks something like this gist:



来源:https://stackoverflow.com/questions/16683735/how-to-logging-with-timed-rotate-file-handler-in-tornado

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