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]

Reply via email to