logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Steele" <pste...@maxiscale.com>
Subject RE: Timestamps and time zones
Date Mon, 20 Oct 2008 18:39:58 GMT
>If you are changing from 8:00 AM PDT to 8:00 AM EDT, you are not just  
>changing the time zone, but you are also changing the time.

Yes, that's correct, both the time zone and time are being set in one
operation.

>Are you changing the timezone using a operating system utility  
>(control panel etc) or by using a call to TimeZone.setDefault()?   

We are using TimeZone.setDefault(). The user sets the time and time zone
in our
GUI and hits an Apply button to invoke the change. 

>Different JVM's may have different approaches to how a change in the  
>operating system timezone becomes visible in the JDK.  If the JDK only

>checks the default timezone at start up, there is nothing log4j can  
>do.  Knowing the vendor and version of the OS and JVM in use and the  
>exact method of making the timezone change would be helpful to  
>understand your observed behavior.  It does appear that you are seeing

>an immediate effect from changing the time, but the timezone is not  
>immediately updated in the app by the manner you are making the change.

We are using JDK 1.5 on FreeBSD 7.0. The code we execute does take
immediate effect
on the system itself as far as the local time is concerned, e.g., the
date command
shows the same date/time/time zone as the user sets in the GUI. The
logger timestamps
however still show the time in the original time zone. 

>I'd suggest using the EnhancedPatternLayout in the extras companion  
>and output the time in a fixed timezone.  Something like:
>
>%d{yyyy-MM-dd HH:mm:ss}{UTC}Z - %c - %m%n
>
>You could also output the time in local time for convenience, but  
>you'd always have the time in a known timezone.

I will check this out but I'm not sure if it will solve the problem.
Ideally, when we
change the time from say 8:00 PDT to 8:00 EDT, we'd like the log
timestamps to also
show 8:00, but what we get is 5:00, at least until we restart the
application. We could
add the explicit time zone but will it just end up showing 5:00 EDT
instead of 8:00 EDT?
Is there a log4j function we could call to force it to resync with the
current local time,
similar to what it must be doing when an application starts?




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message