mirror of https://github.com/python/cpython
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
This commit is contained in:
parent
4b2a6dbf60
commit
5d512fa2e4
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
|
# Copyright 2001-2007 by Vinay Sajip. All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and distribute this software and its
|
# Permission to use, copy, modify, and distribute this software and its
|
||||||
# documentation for any purpose and without fee is hereby granted,
|
# documentation for any purpose and without fee is hereby granted,
|
||||||
|
@ -22,7 +22,7 @@ Apache's log4j system.
|
||||||
Should work under Python versions >= 1.5.2, except that source line
|
Should work under Python versions >= 1.5.2, except that source line
|
||||||
information is not available unless 'sys._getframe()' is.
|
information is not available unless 'sys._getframe()' is.
|
||||||
|
|
||||||
Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
|
Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
|
||||||
|
|
||||||
To use, simply 'import logging' and log away!
|
To use, simply 'import logging' and log away!
|
||||||
"""
|
"""
|
||||||
|
@ -231,11 +231,11 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||||
# of days in the next week until the rollover day (3).
|
# of days in the next week until the rollover day (3).
|
||||||
if when.startswith('W'):
|
if when.startswith('W'):
|
||||||
day = t[6] # 0 is Monday
|
day = t[6] # 0 is Monday
|
||||||
if day > self.dayOfWeek:
|
if day != self.dayOfWeek:
|
||||||
daysToWait = (day - self.dayOfWeek) - 1
|
if day < self.dayOfWeek:
|
||||||
self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24))
|
daysToWait = self.dayOfWeek - day - 1
|
||||||
if day < self.dayOfWeek:
|
else:
|
||||||
daysToWait = (6 - self.dayOfWeek) + day
|
daysToWait = 6 - day + self.dayOfWeek
|
||||||
self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24))
|
self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24))
|
||||||
|
|
||||||
#print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime)
|
#print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime)
|
||||||
|
|
Loading…
Reference in New Issue