Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python RotatingFileHandler中出错_Python_Python 2.7_Python 3.x - Fatal编程技术网

Python RotatingFileHandler中出错

Python RotatingFileHandler中出错,python,python-2.7,python-3.x,Python,Python 2.7,Python 3.x,我正在使用logging.handlers.RotatingFileHandler类进行日志记录 这就是我使用它的方式 logging.handlers.RotatingFileHandler(logpath, "a", maxBytes=2500000, backupCount=5) 日志文件的命名格式为python.log.x,其中x=1,2..5 将生成日志文件 我看到的问题是 在python.log.5日志文件中,我看到了以下条目 2013-06-05 09:58:29994 在pyt

我正在使用logging.handlers.RotatingFileHandler类进行日志记录

这就是我使用它的方式

logging.handlers.RotatingFileHandler(logpath, "a", maxBytes=2500000, backupCount=5)
日志文件的命名格式为python.log.x,其中x=1,2..5

将生成日志文件

我看到的问题是

在python.log.5日志文件中,我看到了以下条目

2013-06-05 09:58:29994

在python.log.4日志文件中,我看到了以下条目

2013-06-05 09:56:29994


但这是错误的。在2013-06-05 09:58:29994应该在python.log.4日志文件中,而2013-06-05 09:56:29994应该在python.log.5日志文件中,条目被反向显示

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

我同意这看起来不对。检查事项:1)可复制性?2) 可能的时区更改3)尝试自己调用
doRollover()
并强制执行?