You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by jw...@ilstechnology.com on 2005/02/17 22:53:18 UTC

0.9.7 timezone part2

I see in the PatternLayout class there is a setTimeZone() method, is there
a way i can load my configuration from a properties file, then get the
appenders 1 by 1 and set the timezone on each of them?

We have an application in which the user can change the timezone of the
system through our software, and right now I have to explicitly declare the
timezone in each appender in order to see the properly adjusted time int he
log files.

Thanks,
Jim



Re: 0.9.7 timezone part2

Posted by Curt Arnold <ca...@apache.org>.
Timezone handling in 0.9.7 is seriously broken (see 
(http://issues.apache.org/jira/browse/LOGCXX-11) and should be avoided 
at all costs.

The CVS HEAD is in transition on this.  It currently supports TimeZone 
and Locale attributes on the pattern layout.  However when the 
capability was added to log4j, it was decided that the timezone should 
be part of the pattern specification.  There is currently an open bug 
in log4cxx (http://issues.apache.org/jira/browse/LOGCXX-49) to 
synchronize log4cxx with log4j and it is marked as a requirement for 
the 0.9.8 release.  It hasn't been an urgent issue for anyone, but I 
can move that to the top of the queue.

The current CVS HEAD supports the same format strings as log4j (and the 
old format strings for compatibility with 0.9.7) and should shortly 
accept the same TimeZone qualifiers.  Basically, what you do is to add 
a second {} after the format specifier containing the timezone.  If not 
specified it will use the current machine timezone.  log4j will 
recognize all the timezones known to the JVM.  log4cxx will only 
recognized {GMT},  {GMT+n:00} and {GMT-n:00}.  Platform specific code 
or calls to ICU would be necessary to support timezones like 
{America/Chicago}.

I'll try to get that task finished shortly.

On Feb 17, 2005, at 3:53 PM, jwert@ilstechnology.com wrote:

> I see in the PatternLayout class there is a setTimeZone() method, is 
> there
> a way i can load my configuration from a properties file, then get the
> appenders 1 by 1 and set the timezone on each of them?
>
> We have an application in which the user can change the timezone of the
> system through our software, and right now I have to explicitly 
> declare the
> timezone in each appender in order to see the properly adjusted time 
> int he
> log files.
>
> Thanks,
> Jim
>
>