Issue #18941: Respected delay when doing rollover.

This commit is contained in:
Vinay Sajip 2013-09-06 10:25:31 +01:00
parent d859926b29
commit 43c6ef1899
2 changed files with 7 additions and 4 deletions

View file

@ -174,7 +174,8 @@ class RotatingFileHandler(BaseRotatingHandler):
if os.path.exists(dfn):
os.remove(dfn)
self.rotate(self.baseFilename, dfn)
self.stream = self._open()
if not self.delay:
self.stream = self._open()
def shouldRollover(self, record):
"""
@ -382,7 +383,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
if self.backupCount > 0:
for s in self.getFilesToDelete():
os.remove(s)
self.stream = self._open()
if not self.delay:
self.stream = self._open()
newRolloverAt = self.computeRollover(currentTime)
while newRolloverAt <= currentTime:
newRolloverAt = newRolloverAt + self.interval