Severity: Info
File: src/Servy.Core/Logging/Logger.cs
Lines: 314-315
Description:
The log entry timestamp is formatted as [yyyy-MM-dd HH:mm:ss] and silently switches between DateTime.UtcNow and DateTime.Now based on _useLocalTimeForRotation:
var now = _useLocalTimeForRotation ? DateTime.Now : DateTime.UtcNow;
string logEntry = $"[{now:yyyy-MM-dd HH:mm:ss}] [{levelName}] {sanitizedMessage}";
There is no marker (Z, UTC, local TZ name/offset) in the formatted output. An operator looking at a Servy.Service.log cannot tell whether the timestamps are UTC or local. On machines that span multiple regions (or where Servy runs in mixed environments), correlating logs across hosts becomes guesswork.
This contradicts the SetUseLocalTimeForRotation doc, which describes the choice as having forensic implications. The same _useLocalTimeForRotation flag also drives LoggerInitializationErrors.log line 120-123 with the same omission.
Suggested fix:
Append a UTC Z suffix when UTC is in effect, or append the local offset (e.g. +02:00) when local is in effect. ISO-8601 round-trip (o) is overkill, but a minimal disambiguator like:
string tzMarker = _useLocalTimeForRotation ? now.ToString("zzz") : "Z";
string logEntry = $"[{now:yyyy-MM-dd HH:mm:ss}{tzMarker}] [{levelName}] {sanitizedMessage}";
would make the timestamp self-describing.
Severity: Info
File:
src/Servy.Core/Logging/Logger.csLines: 314-315
Description:
The log entry timestamp is formatted as
[yyyy-MM-dd HH:mm:ss]and silently switches betweenDateTime.UtcNowandDateTime.Nowbased on_useLocalTimeForRotation:There is no marker (
Z,UTC, local TZ name/offset) in the formatted output. An operator looking at aServy.Service.logcannot tell whether the timestamps are UTC or local. On machines that span multiple regions (or where Servy runs in mixed environments), correlating logs across hosts becomes guesswork.This contradicts the
SetUseLocalTimeForRotationdoc, which describes the choice as having forensic implications. The same_useLocalTimeForRotationflag also drivesLoggerInitializationErrors.logline 120-123 with the same omission.Suggested fix:
Append a UTC
Zsuffix when UTC is in effect, or append the local offset (e.g.+02:00) when local is in effect. ISO-8601 round-trip (o) is overkill, but a minimal disambiguator like:would make the timestamp self-describing.