[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log4j-user
Subject:    Re: Question about Date Format
From:       "Avinash Sridhar" <avnashsridhar () gmail ! com>
Date:       2006-02-26 23:12:57
Message-ID: 26c608730602261512g20e6469dh61a6db7299352a97 () mail ! gmail ! com
[Download RAW message or body]


thanks for the response.

I will find out how the log4J is configured first.


On 2/26/06, Curt Arnold <carnold@apache.org> wrote:
>
>
> On Feb 26, 2006, at 10:54 AM, Avinash Sridhar wrote:
>
> > Hello All,
> >        I am maintaing some code. The requirement is to change this
> > format ,
> > for the application
> >
> > 6-02-15, which, I am hoping is coming from here,
> > defaultProps.setProperty( "
> > log4j.appender.main.DatePattern", "'.'yyyy-MM-dd") ;
> >
> > If it is coming from there, why is it not coming as 2006, it is
> > coming as
> > 6?, I suspect it is coming from here then right?.
> >
> > Is there some other place from where the logging information is
> > coming.
> >
> > Anyway, i changed it to defaultProps.setProperty( "
> > log4j.appender.main.DatePattern", "'.'MM-dd-yyyy") ;
> >
> > and expected the .log file to show up in this format 02-15-6, but i
> > didnt
> > get it in this format. How do i go about doing this?.
> >
> > Is it coming from somewhere else?.
> >
> > Kindly let me know if you require some more information regarding
> > the code.
> >
> > Thanks for looking in
> >
> > Avinash
>
> log4j configuration is described in http://logging.apache.org/log4j/
> docs/manual.html.
>
> log4j can be configured programmatically (that is by explicit calls
> to the log4j API) and also provides two file configurators (an XML
> format and a properties file format).  It does not, however, provide
> any mechanism to configure itself directly from system properties.
> If a system property affects the date format, it is only by
> influencing parameters to API calls or by use in an expression (of
> the form ${propname}) within an XML or property configuration file.
>
> Getting a date formatted like 6-02-15 suggest that a width specifier
> was used which resulted in 2006-02-15 being left truncated.
>
> If you are getting any logging, something is configuring log4j.
> Check for the presence of a log4j.properties or log4j.xml file as
> that would be a common mechanism to configure log4j.  Otherwise,
> check for references to PropertyConfigurator or DOMConfigurator or
> calls to Logger.addAppender (which would be likely be present in code
> programmatically configuring log4j).  Once you have determined how
> log4j is being configured, then we would be able to offer advice on
> how to change the formatting.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic