You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by PoWah Wong <wo...@yahoo.ca> on 2009/02/19 14:14:59 UTC

convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27

The /usr/tomcat/logs/catalina.out file has these entries:
Feb 18, 2009 8:56:27 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8443
Feb 18, 2009 8:56:27 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2377 ms

How to convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27?

I set the files
/opt/axis2-1.2/webapp/WEB-INF/classes/log4j.properties
/usr/local/apache-tomcat-6.0.10/webapps/xmc/WEB-INF/classes/log4j.properties
to:
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c - %m%n
log4j.appender.LOGFILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c %x - %m%n

Restarting tomcat 6 on FC6 linux but the log date format still do not change.



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27

Posted by PoWah Wong <wo...@yahoo.ca>.
--- On Thu, 2/19/09, Martin Gainty <mg...@hotmail.com> wrote:

> From: Martin Gainty <mg...@hotmail.com>
> Subject: RE: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Received: Thursday, February 19, 2009, 12:51 PM
> Wong-
> 
> SimpleDateFormat  is not a attribute in
> java.util.logging.ConsoleHandler
> http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/ConsoleHandler.html
> 
> but org.apache.commons.logging.impl.SimpleLog contains the
> datetime attributes you seek
> org.apache.commons.logging.simplelog.showdatetime -
>      Set to true if you want the current date and time
>      to be included in output messages. Default is
> false.org.apache.commons.logging.simplelog.dateTimeFormat -
>      The date and time format to be used in the output
> messages.
>      The pattern describing the date and time format is the
> same that is
>      used in java.text.SimpleDateFormat. If the format is
> not
>      specified or is invalid, the default format is used.
>      The default format is yyyy/MM/dd HH:mm:ss:SSS zzz.
> please refer to commons-logging JavaDocs for operational
> specifics
> http://commons.apache.org/logging/apidocs/index.html
> 
> Martin 
> ______________________________________________ 
> Disclaimer and confidentiality note 
> Everything in this e-mail and any attachments relates to
> the official business of Sender. This transmission is of a
> confidential nature and Sender does not endorse distribution
> to any party other than intended recipient. Sender does not
> necessarily endorse content contained within this
> transmission. 
> 
> 
> 
> 
> > Date: Thu, 19 Feb 2009 08:51:36 -0800
> > From: wong_powah@yahoo.ca
> > Subject: Re: convert date from Feb 18, 2009 8:56:27 PM
> to 2009-02-18 20:56:27
> > To: users@tomcat.apache.org
> > 
> > 
> > --- On Thu, 2/19/09, Christopher Schultz
> <ch...@christopherschultz.net> wrote:
> > 
> > > From: Christopher Schultz
> <ch...@christopherschultz.net>
> > > Subject: Re: convert date from Feb 18, 2009
> 8:56:27 PM to 2009-02-18 20:56:27
> > > To: "Tomcat Users List"
> <us...@tomcat.apache.org>
> > > Received: Thursday, February 19, 2009, 10:27 AM
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > > 
> > > PoWah,
> > > 
> > > On 2/19/2009 8:14 AM, PoWah Wong wrote:
> > > > The /usr/tomcat/logs/catalina.out file has
> these
> > > entries:
> > > > Feb 18, 2009 8:56:27 PM
> > > org.apache.coyote.http11.Http11AprProtocol start
> > > > INFO: Starting Coyote HTTP/1.1 on http-8443
> > > > Feb 18, 2009 8:56:27 PM
> > > org.apache.catalina.startup.Catalina start
> > > > INFO: Server startup in 2377 ms
> > > 
> > > Are these the only log messages with this date
> format? How
> > > about others?
> > > I ask because it's possible that these
> specific log
> > > messages have the
> > > date format hard-coded into them.
> > > 
> > > > How to convert date from Feb 18, 2009
> 8:56:27 PM to
> > > 2009-02-18 20:56:27?
> > > > 
> > > > I set the files
> > > >
> /opt/axis2-1.2/webapp/WEB-INF/classes/log4j.properties
> > > >
> > >
> /usr/local/apache-tomcat-6.0.10/webapps/xmc/WEB-INF/classes/log4j.properties
> > > 
> > > This configures log4j for your application, and
> does not
> > > affect Tomcat.
> > > You need to modify
> CATALINA_BASE/conf/logging.properties in
> > > order to
> > > affect Tomcat's logging.
> > > 
> > >
> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
> > > 
> > > - -chris
> > > 
> > > -----BEGIN PGP SIGNATURE-----
> > > Version: GnuPG v1.4.9 (MingW32)
> > > Comment: Using GnuPG with Mozilla -
> > > http://enigmail.mozdev.org
> > > 
> > >
> iEYEARECAAYFAkmdekkACgkQ9CaO5/Lv0PB6fACfRbZe/wpTGjySUQaJ04+tyEWE
> > > bFoAn1uFEHUgKcP8qwmhKiXmBM9eXFaR
> > > =yZ08
> > > -----END PGP SIGNATURE-----
> > > 
> > 
> > I tried the following two values for the file
> > /usr/tomcat/conf/logging.properties, restarting tomcat
> does not fix the date format problem.
> > 
> > 1.
> > ...
> > java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
> > java.util.logging.ConsoleHandler.SimpleDateFormat =
> "yyyy-MM-dd HH:mm:ss"
> > ...
> > 
> > 2.
> > ...
> > java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
> > java.util.logging.ConsoleHandler.SimpleDateFormat =
> yyyy-MM-dd HH:mm:ss
> > ...
> 
__________________________________________________________________


These two did not work after restarting tomcat:
java.util.logging.ConsoleHandler.SimpleLog.dateTimeFormat = yyyy-MM-dd HH:mm:ss
java.util.logging.ConsoleHandler.SimpleLog.dateTimeFormat = "yyyy-MM-dd HH:mm:ss"



      __________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27

Posted by Martin Gainty <mg...@hotmail.com>.
Wong-

SimpleDateFormat  is not a attribute in java.util.logging.ConsoleHandler
http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/ConsoleHandler.html

but org.apache.commons.logging.impl.SimpleLog contains the datetime attributes you seek
org.apache.commons.logging.simplelog.showdatetime -
     Set to true if you want the current date and time
     to be included in output messages. Default is false.org.apache.commons.logging.simplelog.dateTimeFormat -
     The date and time format to be used in the output messages.
     The pattern describing the date and time format is the same that is
     used in java.text.SimpleDateFormat. If the format is not
     specified or is invalid, the default format is used.
     The default format is yyyy/MM/dd HH:mm:ss:SSS zzz.
please refer to commons-logging JavaDocs for operational specifics
http://commons.apache.org/logging/apidocs/index.html

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Date: Thu, 19 Feb 2009 08:51:36 -0800
> From: wong_powah@yahoo.ca
> Subject: Re: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27
> To: users@tomcat.apache.org
> 
> 
> --- On Thu, 2/19/09, Christopher Schultz <ch...@christopherschultz.net> wrote:
> 
> > From: Christopher Schultz <ch...@christopherschultz.net>
> > Subject: Re: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27
> > To: "Tomcat Users List" <us...@tomcat.apache.org>
> > Received: Thursday, February 19, 2009, 10:27 AM
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > PoWah,
> > 
> > On 2/19/2009 8:14 AM, PoWah Wong wrote:
> > > The /usr/tomcat/logs/catalina.out file has these
> > entries:
> > > Feb 18, 2009 8:56:27 PM
> > org.apache.coyote.http11.Http11AprProtocol start
> > > INFO: Starting Coyote HTTP/1.1 on http-8443
> > > Feb 18, 2009 8:56:27 PM
> > org.apache.catalina.startup.Catalina start
> > > INFO: Server startup in 2377 ms
> > 
> > Are these the only log messages with this date format? How
> > about others?
> > I ask because it's possible that these specific log
> > messages have the
> > date format hard-coded into them.
> > 
> > > How to convert date from Feb 18, 2009 8:56:27 PM to
> > 2009-02-18 20:56:27?
> > > 
> > > I set the files
> > > /opt/axis2-1.2/webapp/WEB-INF/classes/log4j.properties
> > >
> > /usr/local/apache-tomcat-6.0.10/webapps/xmc/WEB-INF/classes/log4j.properties
> > 
> > This configures log4j for your application, and does not
> > affect Tomcat.
> > You need to modify CATALINA_BASE/conf/logging.properties in
> > order to
> > affect Tomcat's logging.
> > 
> > http://tomcat.apache.org/tomcat-6.0-doc/logging.html
> > 
> > - -chris
> > 
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.9 (MingW32)
> > Comment: Using GnuPG with Mozilla -
> > http://enigmail.mozdev.org
> > 
> > iEYEARECAAYFAkmdekkACgkQ9CaO5/Lv0PB6fACfRbZe/wpTGjySUQaJ04+tyEWE
> > bFoAn1uFEHUgKcP8qwmhKiXmBM9eXFaR
> > =yZ08
> > -----END PGP SIGNATURE-----
> > 
> 
> I tried the following two values for the file
> /usr/tomcat/conf/logging.properties, restarting tomcat does not fix the date format problem.
> 
> 1.
> ...
> java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
> java.util.logging.ConsoleHandler.SimpleDateFormat = "yyyy-MM-dd HH:mm:ss"
> ...
> 
> 2.
> ...
> java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
> java.util.logging.ConsoleHandler.SimpleDateFormat = yyyy-MM-dd HH:mm:ss
> ...
> 
> 
> 
>       __________________________________________________________________
> Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail.  Click on Options in Mail and switch to New Mail today or register for free at http://mail.yahoo.ca
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Stay up to date on your PC, the Web, and your mobile phone with Windows Live.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/

RE: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: PoWah Wong [mailto:wong_powah@yahoo.ca]
> Subject: Re: convert date from Feb 18, 2009 8:56:27 PM to
> 2009-02-18 20:56:27
>
> How to implement my own Formatter?

The doc is here:
http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html

Subclass java.util.logging.Formatter, overriding the format() method.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27

Posted by PoWah Wong <wo...@yahoo.ca>.
--- On Thu, 2/19/09, Christopher Schultz <ch...@christopherschultz.net> wrote:

> From: Christopher Schultz <ch...@christopherschultz.net>
> Subject: Re: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Received: Thursday, February 19, 2009, 1:41 PM
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> PoWah,
> 
> On 2/19/2009 11:51 AM, PoWah Wong wrote:
> > I tried the following two values for the file
> > /usr/tomcat/conf/logging.properties, restarting tomcat
> does not fix the date format problem.
> 
> > 1.
> > ...
> > java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
> > java.util.logging.ConsoleHandler.SimpleDateFormat =
> "yyyy-MM-dd HH:mm:ss"
> > ...
> 
> > 2.
> > ...
> > java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
> > java.util.logging.ConsoleHandler.SimpleDateFormat =
> yyyy-MM-dd HH:mm:ss
> 
> As Martin points out, "SimpleDateFormat" is not
> an attribute of
> java.util.logging.ConsoleHandler. His comments about
> commons-logging are
> confusing, though, because the two logging systems are not
> compatible.
> 
> I believe if you want to change the date format of those
> logging
> statements using Java's logging system, you'll have
> to implement your
> own Formatter.
> 
> See the very last section of this page for
> "formatter":
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla -
> http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkmdp8gACgkQ9CaO5/Lv0PC1OwCfevOkFLtdAhxXrZ4rUqaFqCqn
> brAAnAg0QyPZm+seYUbzS1Q8WCQ6dufM
> =gdBq
> -----END PGP SIGNATURE-----
> 
How to implement my own Formatter?
I googled "tomcat log Formatter" but do not find anything useful.


      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

PoWah,

On 2/19/2009 11:51 AM, PoWah Wong wrote:
> I tried the following two values for the file
> /usr/tomcat/conf/logging.properties, restarting tomcat does not fix the date format problem.

> 1.
> ...
> java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
> java.util.logging.ConsoleHandler.SimpleDateFormat = "yyyy-MM-dd HH:mm:ss"
> ...

> 2.
> ...
> java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
> java.util.logging.ConsoleHandler.SimpleDateFormat = yyyy-MM-dd HH:mm:ss

As Martin points out, "SimpleDateFormat" is not an attribute of
java.util.logging.ConsoleHandler. His comments about commons-logging are
confusing, though, because the two logging systems are not compatible.

I believe if you want to change the date format of those logging
statements using Java's logging system, you'll have to implement your
own Formatter.

See the very last section of this page for "formatter":
http://tomcat.apache.org/tomcat-5.5-doc/logging.html

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmdp8gACgkQ9CaO5/Lv0PC1OwCfevOkFLtdAhxXrZ4rUqaFqCqn
brAAnAg0QyPZm+seYUbzS1Q8WCQ6dufM
=gdBq
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27

Posted by PoWah Wong <wo...@yahoo.ca>.
--- On Thu, 2/19/09, Christopher Schultz <ch...@christopherschultz.net> wrote:

> From: Christopher Schultz <ch...@christopherschultz.net>
> Subject: Re: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Received: Thursday, February 19, 2009, 10:27 AM
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> PoWah,
> 
> On 2/19/2009 8:14 AM, PoWah Wong wrote:
> > The /usr/tomcat/logs/catalina.out file has these
> entries:
> > Feb 18, 2009 8:56:27 PM
> org.apache.coyote.http11.Http11AprProtocol start
> > INFO: Starting Coyote HTTP/1.1 on http-8443
> > Feb 18, 2009 8:56:27 PM
> org.apache.catalina.startup.Catalina start
> > INFO: Server startup in 2377 ms
> 
> Are these the only log messages with this date format? How
> about others?
> I ask because it's possible that these specific log
> messages have the
> date format hard-coded into them.
> 
> > How to convert date from Feb 18, 2009 8:56:27 PM to
> 2009-02-18 20:56:27?
> > 
> > I set the files
> > /opt/axis2-1.2/webapp/WEB-INF/classes/log4j.properties
> >
> /usr/local/apache-tomcat-6.0.10/webapps/xmc/WEB-INF/classes/log4j.properties
> 
> This configures log4j for your application, and does not
> affect Tomcat.
> You need to modify CATALINA_BASE/conf/logging.properties in
> order to
> affect Tomcat's logging.
> 
> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla -
> http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkmdekkACgkQ9CaO5/Lv0PB6fACfRbZe/wpTGjySUQaJ04+tyEWE
> bFoAn1uFEHUgKcP8qwmhKiXmBM9eXFaR
> =yZ08
> -----END PGP SIGNATURE-----
> 

I tried the following two values for the file
/usr/tomcat/conf/logging.properties, restarting tomcat does not fix the date format problem.

1.
...
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.SimpleDateFormat = "yyyy-MM-dd HH:mm:ss"
...

2.
...
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.SimpleDateFormat = yyyy-MM-dd HH:mm:ss
...



      __________________________________________________________________
Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail.  Click on Options in Mail and switch to New Mail today or register for free at http://mail.yahoo.ca

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

PoWah,

On 2/19/2009 8:14 AM, PoWah Wong wrote:
> The /usr/tomcat/logs/catalina.out file has these entries:
> Feb 18, 2009 8:56:27 PM org.apache.coyote.http11.Http11AprProtocol start
> INFO: Starting Coyote HTTP/1.1 on http-8443
> Feb 18, 2009 8:56:27 PM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 2377 ms

Are these the only log messages with this date format? How about others?
I ask because it's possible that these specific log messages have the
date format hard-coded into them.

> How to convert date from Feb 18, 2009 8:56:27 PM to 2009-02-18 20:56:27?
> 
> I set the files
> /opt/axis2-1.2/webapp/WEB-INF/classes/log4j.properties
> /usr/local/apache-tomcat-6.0.10/webapps/xmc/WEB-INF/classes/log4j.properties

This configures log4j for your application, and does not affect Tomcat.
You need to modify CATALINA_BASE/conf/logging.properties in order to
affect Tomcat's logging.

http://tomcat.apache.org/tomcat-6.0-doc/logging.html

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmdekkACgkQ9CaO5/Lv0PB6fACfRbZe/wpTGjySUQaJ04+tyEWE
bFoAn1uFEHUgKcP8qwmhKiXmBM9eXFaR
=yZ08
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org