From general-return-1278-apmail-logging-general-archive=logging.apache.org@logging.apache.org Tue May 06 18:48:16 2008 Return-Path: Delivered-To: apmail-logging-general-archive@www.apache.org Received: (qmail 51923 invoked from network); 6 May 2008 18:48:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 May 2008 18:48:15 -0000 Received: (qmail 76409 invoked by uid 500); 6 May 2008 18:48:17 -0000 Delivered-To: apmail-logging-general-archive@logging.apache.org Received: (qmail 76363 invoked by uid 500); 6 May 2008 18:48:17 -0000 Mailing-List: contact general-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Logging General" List-Id: Delivered-To: mailing list general@logging.apache.org Received: (qmail 76351 invoked by uid 99); 6 May 2008 18:48:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2008 11:48:17 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.30.32] (HELO QMTA03.emeryville.ca.mail.comcast.net) (76.96.30.32) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2008 18:47:30 +0000 Received: from OMTA07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by QMTA03.emeryville.ca.mail.comcast.net with comcast id NHpD1Z00J1GXsucA303x00; Tue, 06 May 2008 18:44:22 +0000 Received: from [192.168.10.106] ([98.197.31.74]) by OMTA07.emeryville.ca.mail.comcast.net with comcast id NJnY1Z0031bxPNA8T00000; Tue, 06 May 2008 18:47:41 +0000 X-Authority-Analysis: v=1.0 c=1 a=4siIqsD3rHAA:10 a=mV9VRH-2AAAA:8 a=CjX-aCtGxUBm4Hqey2IA:9 a=DS9WPNu49ZGN4ZAjugoA:7 a=FvRU7HdpIRCVn9umFQNRCJDQqp8A:4 a=WuK_CZDBSqoA:10 Message-Id: <718AD1DF-550A-441C-AF56-B2FB170EC268@apache.org> From: Curt Arnold To: "Logging General" In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Re: Timezone information in Log4j logs Date: Tue, 6 May 2008 13:47:29 -0500 References: X-Mailer: Apple Mail (2.919.2) X-Virus-Checked: Checked by ClamAV on apache.org On May 6, 2008, at 12:44 PM, Das, Amar wrote: > Hi: > > I have a program running on a server in Dallas. I need to generate > log4j > output in timezone "America/New_York". How can I do that? > > > Current configuration is > > log4j.appender.stdout=org.apache.log4j.ConsoleAppender > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout > log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n > > Thanks log4j usage questions should be asked on log4j-user@logging.apache.org. The enhanced pattern layout in the extras companions supports time zone specifiers on date formats. To use: Download the extras companion from http://logging.apache.org/log4j/companions/extras and place jar on classpath. > log4j.appender.stdout.layout=org.apache.log4j.EnhancedPatternLayout > log4j.appender.stdout.layout.ConversionPattern=%d{}{America/ > New_York} %p [%c] - %m%n The contents of the second brace pair is passed to java.util.TimeZone.getTimeZone() to get the appropriate time zone. There is a guaranteed set of time zone identifiers and then a lot that are platform or implementation specific. If you use "America/ New_York", your configuration file may not work properly if you change platforms or implementations. See the documentation of java.util.TimeZone.getTimeZone() for more specifics.