diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-09-06 09:25:31 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-09-06 09:25:31 (GMT) |
commit | 43c6ef189955474001aad75d3b47d895180b2d42 (patch) | |
tree | 8cbcf803597698b597036f4b509ac60dc0112f56 /Lib/logging/handlers.py | |
parent | d859926b298516402a1e8b963cf62e568f0eb848 (diff) | |
download | cpython-43c6ef189955474001aad75d3b47d895180b2d42.zip cpython-43c6ef189955474001aad75d3b47d895180b2d42.tar.gz cpython-43c6ef189955474001aad75d3b47d895180b2d42.tar.bz2 |
Issue #18941: Respected delay when doing rollover.
Diffstat (limited to 'Lib/logging/handlers.py')
-rw-r--r-- | Lib/logging/handlers.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index f0f634e..ddec7dd 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -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 |