Issue 18940: TimedRotatingFileHandler and RotatingFileHandler fail to doRollover if a logger has delay=True and no logs in that time. (original) (raw)

Issue18940

Created on 2013-09-05 23:49 by solarmist, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
doRollover.patch solarmist,2013-09-06 01:51 Patch for doRollover review
logging_test.py solarmist,2013-09-06 01:53 Demonstrate the bug
Messages (4)
msg197035 - (view) Author: Joshua Olson (solarmist) * Date: 2013-09-05 23:49
In TimedRotatingFileHandler if you have a low volume logger than hasn't written to the log within the interval time doRollover will fail because there is no file to rotate. os.rename(self.baseFilename, dfn) should be something like if os.path.exists(self.base_fileName): os.rename(self.baseFilename, dfn I have included a unit test file. This test fails on 2.7.1 and 2.7.3. I have not tried 2.7.5.
msg197039 - (view) Author: Joshua Olson (solarmist) * Date: 2013-09-06 00:46
Here is a patch for the logging file from the cpython hg repo.
msg197041 - (view) Author: Joshua Olson (solarmist) * Date: 2013-09-06 01:51
This fixes the issue in both RotatingFilerHandler classes.
msg197059 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-06 09:11
New changeset 6a591870017c by Vinay Sajip in branch '2.7': Issue #18940: Handled low-volume logging when delay is True. http://hg.python.org/cpython/rev/6a591870017c New changeset 324774a59256 by Vinay Sajip in branch '3.3': Issue #18940: Handled low-volume logging when delay is True. http://hg.python.org/cpython/rev/324774a59256 New changeset 8002aee72837 by Vinay Sajip in branch 'default': Closes #18940: Merged fix from 3.3. http://hg.python.org/cpython/rev/8002aee72837
History
Date User Action Args
2022-04-11 14:57:50 admin set github: 63140
2013-09-06 09:11:50 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: resolved
2013-09-06 02:42:09 r.david.murray set nosy: + vinay.sajip
2013-09-06 01:53:00 solarmist set files: + logging_test.py
2013-09-06 01:51:21 solarmist set files: + doRollover.patchmessages: + title: TimedRotatingFileHandler fails to doRollover if a logger has delay=True and no logs in that time. -> TimedRotatingFileHandler and RotatingFileHandler fail to doRollover if a logger has delay=True and no logs in that time.
2013-09-06 01:50:18 solarmist set files: - logging_test.py
2013-09-06 01:50:11 solarmist set files: - doRollover.patch
2013-09-06 00:47:48 solarmist set type: behavior
2013-09-06 00:46:02 solarmist set files: + doRollover.patchkeywords: + patchmessages: +
2013-09-05 23:49:27 solarmist create