Bug Description
Log rotation date tracking uses DateTime.Now (local time) instead of DateTime.UtcNow. Daylight saving time transitions can cause a 1-hour jump forward or backward, potentially triggering an unexpected rotation or skipping one.
Location
File: src/Servy.Core/IO/RotatingStreamWriter.cs
Line: 71
Code
_lastRotationDate = File.Exists(path) ? File.GetLastWriteTime(path) : DateTime.Now;
Also used in ShouldRotateByDate() and Rotate() methods with DateTime.Now.
Impact
During DST transitions:
- Spring forward: logs may rotate 1 hour early
- Fall back: logs may skip a rotation or create a duplicate rotation window
Suggested Fix
Use DateTime.UtcNow and File.GetLastWriteTimeUtc() consistently for rotation tracking:
_lastRotationDate = File.Exists(path) ? File.GetLastWriteTimeUtc(path) : DateTime.UtcNow;
Severity
Warning
Bug Description
Log rotation date tracking uses
DateTime.Now(local time) instead ofDateTime.UtcNow. Daylight saving time transitions can cause a 1-hour jump forward or backward, potentially triggering an unexpected rotation or skipping one.Location
File:
src/Servy.Core/IO/RotatingStreamWriter.csLine: 71
Code
Also used in
ShouldRotateByDate()andRotate()methods withDateTime.Now.Impact
During DST transitions:
Suggested Fix
Use
DateTime.UtcNowandFile.GetLastWriteTimeUtc()consistently for rotation tracking:Severity
Warning