So are you saying that if I set it up as a value in my deployment
description, log4j will find it?  That setting things in deployment
descriptiors is the same as setting them up as system properties?

I am in a similar situation where I want to use log4j for my EJB's, but
always have to pass in something to set up the logj path.. 

Eric

-----Original Message-----
From: Paul Glezen [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 12:20 PM
To: LOG4J Users Mailing List
Subject: Re: Auto-configure log4j ?


Hi Ferdinand,

I think you want to take advantage of the static initializer build into
the Category class.  By setting a system property called
"log4j.configuration", you can determine the resource URL that
configures your logging infrastructure.  If this property is not set,
then it looks for log4j.properties somewhere in the classpath.  If you
are using an EJB Server, then setting this property somewhere in the
deployment descriptor should set you up.

This is an important feature for EJB users since in many cases, one is
not sure in what order classes will be instanciated and invoked.

For more information on this log4j bootstrapping process, check out the
Category's javadoc.  In particular, read the information on the
log4j.configuration field.  Grabbing a peak at the static initializer in
the Category.java source code should also make things clear.

Good luck,
- Paul Glezen

> I have a question w.r.t. Configuring (initializing) log4j:
> 
> If I start a Webserver or an EJBServer, I must initialize log4j.
> 
> I can do this 'by hand' (e.g. by writing a servlet that configures log4j
by
> either using BasicConfigurator, DOMConfigurator or PropertyConfigurator).
> 
> Is it also possible to let log4j configure itself automatically upon the
> first category.getInstance()... ? This would save writing the
> 'initialization' in WEBServer or EJBServer.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to