[logback-user] Localtime(from server) to be printed instead of GMT

Kriti Wadhwa kriti.wadhwa at tcs.com
Thu Jun 13 08:42:06 CEST 2013


Hi,
 
Thanks a lot for the info & update in the documentation.

You are very correct, there was a small flaw in the application only. After I restarted the Java process (linux box), the logs automatically took up the local time.
Clarification in the documentation is of great help as it removed the confusion as to what is the defualt behavior: local time which Java thinks is unning under and Not GMT.
 
Thank again.
Kriti

 
-----"Logback-user" <logback-user-bounces at qos.ch> wrote: -----


To: logback users list <logback-user at qos.ch>
From: Ceki Gülcü <ceki at qos.ch>
Sent by: "Logback-user" <logback-user-bounces at qos.ch>
Date: 06/11/2013 07:43PM
Subject: Re: [logback-user] Localtime(from server) to be printed instead of GMT

I updated the %d documentation to explain the timezone parameter as 
clearly as possible.

   http://logback.qos.ch/manual/layouts.html#date

The key sentences are:

Note that in the absence of the timezone parameter, the default timezone 
of the host Java platform is used. If the specified timezone identifier 
is unknown or misspelled, the GMT timezone is assumed as dictated by the 
TimeZone.getTimeZone(String) method specification.




On 6/11/2013 3:51 PM, Thorbjørn Ravn Andersen wrote:
> This system might using be a timezone abbreviation not recognized by the
> JVM.
>
> I spent quite some time a long while back figuring out why an OS/2 JVM was
> 3.5 hours off.  It turned out that the OS/2 abbreviation for central
> European time was not quite what the JVM expected.
>
>
>
> -----Original Message-----
> From: Logback-user [mailto:logback-user-bounces at qos.ch] On Behalf Of Steve
> Cohen
> Sent: 11. juni 2013 15:34
> To: logback-user at qos.ch
> Subject: Re: [logback-user] Localtime(from server) to be printed instead of
> GMT
>
> I'm pretty sure that the default is whatever timezone Java thinks it is
> running under.  Normally this is the local timezone, but I have seen setups
> where some of Java's time zone information files have been removed, which
> causes Java to default to GMT.  Java out of the box does not do that.  What
> version of the JDK are you using and has it been modified or is it direct
> from Oracle or other vendor?
>
> By default Java does not read a timezone from /etc/localtime, which of
> course does not exist under all OSes.  I do not know whether or not logback
> has features to customize timestamps beyond what you are using.
>    It may be that it hasn't been considered necessary since there are many
> opportunities to customize Java.
>
> So your first step is to figure out why Java is defaulting to GMT.
> Again, that is not the normal behavior.
>
> On 06/11/2013 02:53 AM, Kriti Wadhwa wrote:
>> Hello,
>> As per my understanding currently using following pattern:
>>
>> <encoder>
>>
>> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %class{0}
>> %_msg_%n</pattern>
>>
>> </encoder>
>>
>> Time stamp printed in log files display time in GMT format by default.
>> Using %date{HH:mm:ss.SSS,Australia/Perth} we can set the timezone to a
>> particular value (In this case Australia/Perth).
>> In my application I need:
>> Time zone to be picked up from local server (/etc/localtime) where the
>> application is running instead of setting it to a specific value in
>> xml as shown above. How can I do this using logback.xml ?
>> Please suggest.
>> Thanks,
>> Kriti
>>
>> =====-----=====-----=====
>> Notice: The information contained in this e-mail message and/or
>> attachments to it may contain confidential or privileged information.
>> If you are not the intended recipient, any dissemination, use, review,
>> distribution, printing or copying of the information contained in this
>> e-mail message and/or attachments to it are strictly prohibited. If
>> you have received this communication in error, please notify us by
>> reply e-mail or telephone and immediately and permanently delete the
>> message and any attachments. Thank you
>>
>>
>>
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://mailman.qos.ch/mailman/listinfo/logback-user
>>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130613/4d48e607/attachment.html>


More information about the Logback-user mailing list