简体   繁体   中英

Error in Python RotatingFileHandler

I'm using logging.handlers.RotatingFileHandler class for logging.

This is how I'm using it.

logging.handlers.RotatingFileHandler(logpath, "a", maxBytes=2500000, backupCount=5)

The log files are named in this format python.log.x where x=1,2..5

The log files are generated.

The problem I see here is

In python.log.5 log file, I'm seeing this entry

2013-06-05 09:58:29,994

In python.log.4 log file, I'm seeing this entry

2013-06-05 09:56:29,994

But this is wrong. The entries are seen reversed where the 2013-06-05 09:58:29,994 should be in python.log.4 log file and 2013-06-05 09:56:29,994 should be in python.log.5 log file.

这必须发生,因为您的日志记录类正在被多个进程使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM