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 Surya Poola <su...@yahoo.com> on 2007/02/27 15:49:48 UTC

log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

Hi,
     
  When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls.
   
  my code looks like:
  JoranConfigurator jc = new JoranConfigurator();
jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
  logger.info("test log" );
   
  I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator.
   
  But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator.
   
  So could any one help me in finding a solution with JoranConfigurator.
  Regards,
Rohan
Surya Poola <su...@yahoo.com> wrote:
    Dirk,
    I have multiple instance of webapp applications .So currently i tried by saving my log4j.xml file in WEB-INF/classes folder.
  The file is been picked up, but i am getting the same warnings that i got earlier without any file output( Ihave switched on the debug . mode)
  log4j:WARN Continuable parsing error 3 and column 29
log4j:WARN Document root element "configuration", must match DOCTYPE root "null".
log4j:WARN Continuable parsing error 3 and column 29
log4j:WARN Document is invalid: no grammar found.
log4j:WARN The <configuration> element has been deprecated.
log4j:WARN Use the <log4j:configuration> element instead.
log4j: Threshold ="".
log4j: Level value for root is  [info].
log4j: root level set to INFO
log4j: Class name: [org.apache.log4j.rolling.RollingFileAppender]
log4j: Setting property [append] to [true].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [%d{yyyy-MM-dd HH:mm:ss},%p,%c,%t %m%n].
   
  My log4j.xml file looks like:
  <?xml version="1.0" encoding="UTF-8"?>
  <configuration debug="true">
  <appender class="org.apache.log4j.rolling.RollingFileAppender" name="MyFileAppender">
  <param name="Append" value="true"/>
  <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
  <param name="FileNamePattern" value="/pkg/vdqxx/home//jakarta-tomcat-4.1.30/logs/a.log.%d{yyyy-MM)"/>
  </rollingPolicy>
  <layout class="org.apache.log4j.PatternLayout">
  <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss},%p,%c,%t %m%n"/>
  </layout>
  </appender>
  <root>
  <level value="info"/>
  <appender-ref ref="MyFileAppender"/>
  </root>
  </configuration>
  
and i just given the following stements in my code:
  logger=Logger.getLogger (Classname.class);
  logger.info("Perormance log Classname");
   
  is the default configurator DOM or Joran .as per the output it looks like DOM.
  Can you help me in fixing this issue.
   
  Thanks in advance.
  Regards
  Rohan
  
Dirk Ooms <di...@onesparrow.com> wrote:
  Rohan,
do you have multiple instances of tomcat or multiple webapps within tomcat? anyway, typically one puts the log4j.xml in the WEB-INF/classes of each webapp. it will then be picked up by JoranConfigurator (without doing anything explicit in your code, except for a getLogger()). Do not use the in version 1.3, JoranConfigurator does not accept it.

dirk

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


    
---------------------------------
  No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.    
---------------------------------
  Any questions? Get answers on any topic at Yahoo! Answers. Try it now.

 
---------------------------------
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.
 
---------------------------------
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.

Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

Posted by Surya Poola <su...@yahoo.com>.
Thanks for your help, I am placing the log4j configuration in classes folder ,and refer  to the file location using sytem property in xml.
  
Thanks 
  Rohan
James Stauffer <st...@gmail.com> wrote:
  If you are calling doConfigure in doGet of each servlet then it is
being configured multiple times -- once for each request processed.
The easiest way to configure it only once is to put the config file in
the classpath and allow it to be automatically configured. An
alternative is to call doconfigure in static code that is only called
once.

On 2/27/07, Surya Poola wrote:
> Iam sure the code is only executed once, why because without specifying any configurator and placing log4j.xml in classes folder of the web application, everything works fine.But when i specify configurator and remove the log4j.xml from classes folder and place log4j.xml in different location and refer the log4j.xml by configurator then iam facing this problem.
>
> Iam running my program through tomcat,and calling my program in doget() method of servlets like:
> logger=Logger.getLogger(this.getClass().getName());
> JoranConfigurator jc = new JoranConfigurator();
> jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
> logger.info("test log" );
>
> Regards
> Rohan
>
> James Stauffer wrote: Are you sure that code is only executed once per program run? Are you
> running in Tomcat, and where are you calling doConfigure?
>
> On 2/27/07, Surya Poola wrote:
> > Iam calling jc.doconfigure only once in my program.I hope this should not be the
> > problem.
> >
> >
> > James Stauffer wrote:
> > Are you calling jc.doConfigure multiple times? It should only be
> > called once during the program run.
> >
> > On 2/27/07, Surya Poola wrote:
> > > Hi,
> > >
> > > When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls.
> > >
> > > my code looks like:
> > > JoranConfigurator jc = new JoranConfigurator();
> > > jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
> > > logger.info("test log" );
> > >
> > > I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator.
> > >
> > > But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator.
> >
> > --
> > James Stauffer http://www.geocities.com/stauffer_james/
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >
> >
> > ---------------------------------
> > No need to miss a message. Get email on-the-go
> > with Yahoo! Mail for Mobile. Get started.
>
>
> --
> James Stauffer http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> Expecting? Get great news right away with email Auto-Check.
> Try the Yahoo! Mail Beta.
>
> ---------------------------------
> Access over 1 million songs - Yahoo! Music Unlimited.


-- 
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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



 
---------------------------------
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile. Get started!
  
---------------------------------
Looking for earth-friendly autos? 
 Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.  

Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

Posted by James Stauffer <st...@gmail.com>.
If you are calling doConfigure in doGet of each servlet then it is
being configured multiple times -- once for each request processed.
The easiest way to configure it only once is to put the config file in
the classpath and allow it to be automatically configured.  An
alternative is to call doconfigure in static code that is only called
once.

On 2/27/07, Surya Poola <su...@yahoo.com> wrote:
> Iam sure the code is only executed once, why because without specifying any configurator and placing log4j.xml in classes folder of the web application, everything works fine.But when i specify configurator and remove the log4j.xml from classes folder and place log4j.xml in different location and refer the log4j.xml by configurator then iam facing this problem.
>
> Iam running my program through tomcat,and calling my program in doget() method of servlets like:
> logger=Logger.getLogger(this.getClass().getName());
> JoranConfigurator jc = new JoranConfigurator();
>  jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
>  logger.info("test log" );
>
> Regards
> Rohan
>
> James Stauffer <st...@gmail.com> wrote: Are you sure that code is only executed once per program run?  Are you
> running in Tomcat, and where are you calling doConfigure?
>
> On 2/27/07, Surya Poola  wrote:
> > Iam calling jc.doconfigure only once in my program.I hope this should not be the
> >   problem.
> >
> >
> > James Stauffer  wrote:
> >   Are you calling jc.doConfigure multiple times? It should only be
> > called once during the program run.
> >
> > On 2/27/07, Surya Poola wrote:
> > > Hi,
> > >
> > > When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls.
> > >
> > > my code looks like:
> > > JoranConfigurator jc = new JoranConfigurator();
> > > jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
> > > logger.info("test log" );
> > >
> > > I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator.
> > >
> > > But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator.
> >
> > --
> > James Stauffer http://www.geocities.com/stauffer_james/
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >
> >
> > ---------------------------------
> > No need to miss a message. Get email on-the-go
> > with Yahoo! Mail for Mobile. Get started.
>
>
> --
> James Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> Expecting? Get great news right away with email Auto-Check.
> Try the Yahoo! Mail Beta.
>
> ---------------------------------
> Access over 1 million songs - Yahoo! Music Unlimited.


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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


Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

Posted by Surya Poola <su...@yahoo.com>.
Iam sure the code is only executed once, why because without specifying any configurator and placing log4j.xml in classes folder of the web application, everything works fine.But when i specify configurator and remove the log4j.xml from classes folder and place log4j.xml in different location and refer the log4j.xml by configurator then iam facing this problem.

Iam running my program through tomcat,and calling my program in doget() method of servlets like:
logger=Logger.getLogger(this.getClass().getName());
JoranConfigurator jc = new JoranConfigurator();
 jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
 logger.info("test log" );

Regards
Rohan

James Stauffer <st...@gmail.com> wrote: Are you sure that code is only executed once per program run?  Are you
running in Tomcat, and where are you calling doConfigure?

On 2/27/07, Surya Poola  wrote:
> Iam calling jc.doconfigure only once in my program.I hope this should not be the
>   problem.
>
>
> James Stauffer  wrote:
>   Are you calling jc.doConfigure multiple times? It should only be
> called once during the program run.
>
> On 2/27/07, Surya Poola wrote:
> > Hi,
> >
> > When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls.
> >
> > my code looks like:
> > JoranConfigurator jc = new JoranConfigurator();
> > jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
> > logger.info("test log" );
> >
> > I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator.
> >
> > But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator.
>
> --
> James Stauffer http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> No need to miss a message. Get email on-the-go
> with Yahoo! Mail for Mobile. Get started.


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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



 
---------------------------------
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
 
---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.

Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

Posted by James Stauffer <st...@gmail.com>.
Are you sure that code is only executed once per program run?  Are you
running in Tomcat, and where are you calling doConfigure?

On 2/27/07, Surya Poola <su...@yahoo.com> wrote:
> Iam calling jc.doconfigure only once in my program.I hope this should not be the
>   problem.
>
>
> James Stauffer <st...@gmail.com> wrote:
>   Are you calling jc.doConfigure multiple times? It should only be
> called once during the program run.
>
> On 2/27/07, Surya Poola wrote:
> > Hi,
> >
> > When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls.
> >
> > my code looks like:
> > JoranConfigurator jc = new JoranConfigurator();
> > jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
> > logger.info("test log" );
> >
> > I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator.
> >
> > But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator.
>
> --
> James Stauffer http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> No need to miss a message. Get email on-the-go
> with Yahoo! Mail for Mobile. Get started.


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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


Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

Posted by Surya Poola <su...@yahoo.com>.
Iam calling jc.doconfigure only once in my program.I hope this should not be the
  problem.
   
  
James Stauffer <st...@gmail.com> wrote:
  Are you calling jc.doConfigure multiple times? It should only be
called once during the program run.

On 2/27/07, Surya Poola wrote:
> Hi,
>
> When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls.
>
> my code looks like:
> JoranConfigurator jc = new JoranConfigurator();
> jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
> logger.info("test log" );
>
> I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator.
>
> But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator.

-- 
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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



 
---------------------------------
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.

Re: log4j1.3 alpha8 using joran configurator logs text in folds(multiples)

Posted by James Stauffer <st...@gmail.com>.
Are you calling jc.doConfigure multiple times?  It should only be
called once during the program run.

On 2/27/07, Surya Poola <su...@yahoo.com> wrote:
> Hi,
>
>   When Iam using joran configurator in log4j1.3 alpha 8 version, log is written in folds into log file.ie, first call of execution of my program writes the text once, for second call it writes twice and the logging is growing exponentially for subsequent calls.
>
>   my code looks like:
>   JoranConfigurator jc = new JoranConfigurator();
> jc.doConfigure("C:\jakarta-tomcat-4.1.30\webapps\log4j.xml",LogManager.getLoggerRepository())
>   logger.info("test log" );
>
>   I tried using the deprecated DOMConfigurator also, but this also behaves the same ,because DOMConfigurator is extended from JoranConfigurator.
>
>   But when i keep the log4j.xml file in classes folder of web application and not specifying any configurator then the logging is happening perfectly.So i hope the problem is using JoranConfigurator.

-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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