William Jaynes wrote:
> 
> I trace this anomaly to the following line in Category.java
>         url = Loader.getResource(resource, Object.class);
> I believe that "Category.class" rather than "Object.class" should be
> used. ...

This change might help in some situations.  But it is not going to
address the Tomcat issue.  As people have pointed out, the problem is
simple. People would like to place log4j.jar in either the Tomcat
classpath or the WEB-INF/lib directory of their webapp.  We would like
to place our config file closer to the app, say in WEB-INF/classes or
WEB-INF/lib.  This allows each webapp to have their own configuration
(assuming one JVM per webapp, not always a good assumption).  It also
increases the potential for dynamic reconfiguration.

The problem that has been hashed over and over is that classes loaded
from jars in WEB-INF/lib or tomcat's lib don't see WEB-INF/lib or
WEB-INF/classes.  There are no class loader games you can play to change
this as far as I know.  Certainly Category's classloader won't help any
here.

I'm adding a servlet to the examples.appserver package which does
nothing but initialize log4j.  Since it is a servlet, it can see
WEB-INF/classes.  (It can also see the webapp root, but since that's
publicly accessible, I didn't think some people would want config files
in there).  It acquires the URL of the config file and passes this to a
property configurator.  The property configurator can take it from here
since the reference is in the form of a URL instead of an unqualified
filename.

The Javadoc for the class will contain details about how to configure
web.xml to affect the behavior of the servlet, called WebAppInit.  I
should have it checked in to CVS by the end of the day.  It works fine
with Tomcat; I haven't tried it with commercial app servers.  I consider
this a temporary solution until a systematic approach is decided upon.

- Paul
-- 
Beware of bugs in the above code.  I have
only proved it correct, not tried it.  -Don Knuth

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

Reply via email to