Twisted log rotation by size / having an upper limit on the total number of files?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 14:53:02

You can use the option logger. You will have to write your own logger factory, something like this

#in module mymodule, file <log.py>
def my_logger():
    f = logfile.LogFile("twistd_alert.log", '/var/log/', rotateLength=1000000, maxRotatedFiles=100)
    log_observer = log.FileLogObserver(f)
    return log_observer.emit

Then while running the server you can specify the option logger as

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