Bug 46046

Summary: Date conversion in PatternLayout does not follow changes to default time zone
Product: Log4j - Now in Jira Reporter: Curt Arnold <carnold>
Component: LayoutAssignee: log4j-dev <log4j-dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   

Description Curt Arnold 2008-10-20 15:56:15 UTC
List:       log4j-user
Subject:    Timestamps and time zones
From:       "Peter Steele" <psteele () maxiscale ! com>
Date:       2008-10-19 20:12:27


We've noticed somewhat undersirable logging behavior when we change the
time zone our appllicaton is running under. When the application starts,
the timestamps used in our log files match the current local time,
albeit without an explicit time zone identifier included in the time,
but that's okay. However, if we change the time zone, e.g. from 8:00 am
PDT to 8:00 am EDT, while the local time simply starts displaying the
new time zone identifier, the log timestamps get shifted by the
difference in the time zones. In this specific case, the log timestamps
would get shifted to 5:00 am.

 

If we then stop and restart the application, the timestamps are then
based again on the local time (8:00 am instead of 5:00 am). This is what
we want of course, but we want this to happen dynamically as well and
not have to restart the application to get the timestamps in sync with
the local time. How can we accomplish this? We want the timestamps to
match whatever the local time is, regardless of the time zone, even
after a time zone change. Is there a logger call we can make?

Thread continues at http://marc.info/?l=log4j-user&m=122444718829901&w=2
Comment 1 Curt Arnold 2009-01-08 10:23:57 UTC
Committed fix to extras EnhancedDateFormat in rev 706445 and 706451.