logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: GMT time format
Date Tue, 06 Sep 2005 17:24:53 GMT

On Sep 6, 2005, at 4:27 AM, Subhendu wrote:

> What should be added with %d so that we get the time-stamp in GMT  
> format?
> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
>   <layout class="org.apache.log4j.PatternLayout">
>          <param name="ConversionPattern"
>                             value="%d %-5p [%t] %C{2} (%F:%L) - %m% 
> n"/>
>   </layout>
>  </appender>
> Thanks
> Subhendu

Support for arbitrary timezones was added to the CVS HEAD (not the  
1.2 branch) with bug 32064 (http://issues.apache.org/bugzilla/ 
show_bug.cgi?id=32064).  Basically, a time zone identifier can be  
added using a second brace after the %d.

> <param name="ConversionPattern"
>                             value="%d{yyyy-MM-dd HH:mm:ss}{GMT}Z  
> %-5p [%t] %C{2} (%F:%L) - %m%n"/>

Should work.

I have not tested what would happen if you used:

> <param name="ConversionPattern"
>                             value="%d{}{GMT}Z %-5p [%t] %C{2} (%F:% 
> L) - %m%n"/>

I don't know if an empty format specifier would be treated as the  
default, or if it would be a empty string format specifier which  
would omit emitting the date.  I'm guessing it is the latter.

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

View raw message