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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to