Python log rotation - after rotation, new log entries were written to the old rotated log file
I am writing a pyramid application, very simple.
I have set my logger to my pyramid file .ini
as shown below, again quite simple
[loggers]
keys=root
[logger_root]
level=INFO
handlers=timedRotatingFileHandler
[formatters]
keys=timedRotatingFormatter
[formatter_timedRotatingFormatter]
format=%(asctime)s %(name)-12s %(levelname)-8s %(message)s
datefmt=%m-%d %H:%M
[handlers]
keys=timedRotatingFileHandler
[handler_timedRotatingFileHandler]
class=handlers.TimedRotatingFileHandler
level=INFO
formatter=timedRotatingFormatter
args=('/data/logs/mylog.log', 'midnight')
The weird thing is that the log files were rotated at midnight, but since the rotation, new log entries for the new day are written to yesterday's log file.
For example, let's say today 2015-08-06
.
At 00:00
midnight, today mylog.log
turns and the name changes to mylog.log.20150806
, until no problem.
But since then, new entries in the journal begin to be recorded in mylog.log.20150806
instead of the new one mylog.log
.
Why is this?
source to share
No one has answered this question yet