但这样实际运行后,并不能删除旧的日志文件,好像是因为修改了.suffix以后,后缀不再与默认的extMatch内容匹配导致的。
但我如果把上面的注释行去掉,自己指定.extMatch属性,又会报错:
Traceback (most recent call last):
File "C:\Python27\lib\logging\handlers.py", line 77, in emit
self.doRollover()
File "C:\Python27\lib\logging\handlers.py", line 352, in doRollover
for s in self.getFilesToDelete():
File "C:\Python27\lib\logging\handlers.py", line 310, in getFilesToDelete
if self.extMatch.match(suffix):
AttributeError: 'str' object has no attribute 'match'
Logged from file HelloWorld.py, line 8