logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gulcu <...@urbanet.ch>
Subject Re: Configuration in stateless objects?
Date Thu, 11 Jan 2001 00:47:37 GMT


I suppose you are aware of the static initialization procedure in 
Category.java? When the Categroy class is loaded it will search for the 
file "log4j.properties" in the classpath.

Furthermore, you can set the log4j.configuration system value to a file 
path or a URL to parse a different file then "log4j.properties"  If the URL 
ends in .xml then the DOMConfigurator will be used to parse the file.

There is an additional twist: if the URL has a reference part, then that 
will be used as the class name of the configurator class.

For example if you invoke your application using the command line


     then the log4j will be configured by a new instance of 
com.myCompany.myConfigurator using the file referenced by

Does this help? Ceki

At 09:27 10.01.2001 -0500, you wrote:
>I have an implementation question:
>We have lots of code (servlets, JSPs, EJBs) that execute within an
>application server as stateless client objects.  Therefore, we have no easy
>access to the startup logic of the JVM from which to invoke the
>PropertyConfigurator.configure() method.  I think the right way to do this
>is to define a subclass of Category (similar to MyCategory) and implement a
>static block within this class to configure the system.  As long as all
>logging uses this derived Category subclass, then the first call to
>getInstance() will configure the system.
>Is there a better way to do this?

View raw message