[issue1321] TimedRotatingFileHandler logic for day of week is wrong

Moshe Cohen report at bugs.python.org
Wed Oct 24 10:21:32 CEST 2007


New submission from Moshe Cohen:

The logic for determining the time till midnight on the requested day of
week is reversed.
>From logging/handlers.py:234 

                if day > self.dayOfWeek:
                    daysToWait = (day - self.dayOfWeek) - 1
                    self.rolloverAt = self.rolloverAt + (daysToWait *
(60 * 60 * 24))
                if day < self.dayOfWeek:
                    daysToWait = (6 - self.dayOfWeek) + day
                    self.rolloverAt = self.rolloverAt + (daysToWait *
(60 * 60 * 24))

The two cases are reversed. 'day' is the current day. 'self.dayOfWeek'
is the desired day.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1321>
__________________________________


More information about the Python-bugs-list mailing list