This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: TimedRotatingFileHandler chooses wrong file name due to daylight saving time "spring forward"
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Matt.Mullins, python-dev, vinay.sajip
Priority: normal Keywords:

Created on 2012-03-12 21:18 by Matt.Mullins, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
logger_test.py Matt.Mullins, 2012-03-12 21:18 Example script to demonstrate logging across the end of a day
Messages (2)
msg155482 - (view) Author: Matt Mullins (Matt.Mullins) Date: 2012-03-12 21:18
As logs were rotated at midnight this morning (at the end of the day 2012-03-11), we detected that the logs were incorrectly renamed to *.log.2012-03-10, causing logs from Saturday to be overwritten.  I believe this bug is related to the transition to daylight saving time, as this is the only day in recent history that this has occurred.

I have attached a script to reproduce this bug.  This works reliably in the US/Pacific time zone.  To run it, execute "rm foo.log* ; sudo date 03112359.55 && python logger_test.py".  This will cause ten records to be logged, across the midnight boundary from 2012-03-11 23:59:55 to 2012-03-12 00:00:05.

Expected behavior: the logs from 2012-03-11 up to, but not including, 2012-03-12 00:00:00 should be written to a file named "foo.log.2012-03-11", and the remainder of the log entries should be written to "foo.log".

Actual behavior: the logs from 2012-03-11 23:59 through, but not including, 2012-03-12 00:00 are instead written to a file named "foo.log.2012-03-10", and the remainder of the log entries are written to "foo.log".

This does not happen for any other day.  For example: running "sudo date 02152359.55" in the above procedure correctly names the file "foo.log.2012-02-15".
msg155597 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-03-13 12:19
New changeset a5c4b8ccca8b by Vinay Sajip in branch '2.7':
Closes #14267: Corrected computation of rollover filename.
http://hg.python.org/cpython/rev/a5c4b8ccca8b

New changeset a1d9466441ff by Vinay Sajip in branch '3.2':
Closes #14267: Corrected computation of rollover filename.
http://hg.python.org/cpython/rev/a1d9466441ff

New changeset 30fe8a62046e by Vinay Sajip in branch 'default':
Closes #14267: Merged fix from 3.2.
http://hg.python.org/cpython/rev/30fe8a62046e
History
Date User Action Args
2022-04-11 14:57:27adminsetgithub: 58475
2012-03-13 12:19:43python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg155597

resolution: fixed
stage: resolved
2012-03-12 22:57:38pitrousetnosy: + vinay.sajip

versions: + Python 3.2, Python 3.3, - Python 2.6
2012-03-12 21:18:39Matt.Mullinscreate