在标有“TimedRotatingLogs”的部分要求对这篇文章进行一些澄清:https://www.blog.pythonlibrary.org/2014/02/11/python-how-to-create-rotating-logs/
handler = TimedRotatingFileHandler(path,
when="m",
interval=1,
backupCount=5)
我对这部分特别好奇。在查看文章时,它说“WeekDay”做“w0-w6”。 会像这样吗? :
handler = TimedRotatingFileHandler(path,
when="w",
interval=0,
backupCount=5)
或者它看起来像:
handler = TimedRotatingFileHandler(path,
when="w0",
interval=1,
backupCount=5)
并解释为什么一个比另一个好
请您参考如下方法:
根据 Kite Docs 上的文章.它指出
When using weekday-based rotation, specify ‘W0’ for Monday, ‘W1’ for Tuesday, and so on up to ‘W6’ for Sunday. In this case, the value passed for interval isn’t used.
所以从那里开始你的情况下的代码是
handler = TimedRotatingFileHandler(path, when="w0", backupCount=5)
