Issue 13469: TimedRotatingFileHandler fails to handle intervals of several weeks correctly (original) (raw)

When specifying a time period of several weeks, say when w0 and interval 4, the rollover still happens weekly instead of every 4 weeks. The log file names are as though the rollover happens every 4 weeks, which furthers the confusion.

In the file system, it looks like this:

-rw-r----- 1 x x 94189100 2011-10-24 23:59 x.log.2011-09-27 -rw-r----- 1 x x 51059765 2011-11-01 00:59 x.log.2011-10-04

This seems to be the result of computeRollover not handling multiple weeks at all.

TimedRotatingFileHandler does not, by design, support multiple-week rollovers: the W mode is for a specific day of the week, and is documented as "Weekday" rather than "Weeks" (the other modes are documented as Seconds, Minutes, Hours, Days).

I don't currently have time to consider such support, but I'll certainly look at a patch (with tests).