TimedRotatingFileHandler Changing File Name?

前端 未结 5 1605
臣服心动
臣服心动 2020-12-04 22:48

I am trying to implement the python logging handler TimedRotatingFileHandler.

When it rolls over to midnight it appends the current day in the form

5条回答
  •  囚心锁ツ
    2020-12-04 23:13

    You can do this by changing the log suffix as suggested above but you will also need to change the extMatch variable to match the suffix for it to find rotated files:

    handler.suffix = "%Y%m%d"
    handler.extMatch = re.compile(r"^\d{8}$")
    

提交回复
热议问题