You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Subhendu <ma...@mahindrabt.com> on 2005/09/06 11:27:58 UTC

GMT time format

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

*********************************************************
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if any) are privileged and confidential material of MBT and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee(s).   In case you are not the desired addressee, you should delete this message and/or re-direct it to the sender.  The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if any) are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be free of any virus.  However, it is the responsibility of the recipient to ensure that it is virus free and MBT is not responsible for any loss or damage arising in any way from its use

*********************************************************

Re: GMT time format

Posted by Arunkumar Soundararajan <so...@lightsurf.com>.
Hi

I dont think you can give any timezone specific here but you can
definitly add the format for time. For ex:

%d{dd MMM yyyy HH:mm:ss,SSS} will return 05 Sept 2005 and appropriate
time with it.

Hope this helps..
Arun


On Tue, 2005-09-06 at 14:57, 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
> 
> *********************************************************
> Disclaimer:
> 
> The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if any) are privileged and confidential material of MBT and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee(s).   In case you are not the desired addressee, you should delete this message and/or re-direct it to the sender.  The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if any) are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of MBT.
> 
> This e-mail message including attachment/(s), if any, is believed to be free of any virus.  However, it is the responsibility of the recipient to ensure that it is virus free and MBT is not responsible for any loss or damage arising in any way from its use
> 
> *********************************************************


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


Re: GMT time format

Posted by Curt Arnold <ca...@apache.org>.
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