logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <...@qos.ch>
Subject Re: patch for static init problem
Date Thu, 31 May 2001 11:30:41 GMT


I am looking into this right now. Ceki

At 07:00 31.05.2001 -0400, you wrote:
>I don't actually know how to submit a patch, but I'd like a change made
>to the static initializer in Category.java. I believe this small change
>will "fix", as much as it can be fixed, the problems that many users are
>having with the static initializer finding the log4j.properties file. My
>reasoning is below, copied from a thread on the log4j-user list.
>So I request that in the static initializer of Category.java change
>url = Loader.getResource(resource, Object.class);
>url = Loader.getResource(resource, Category.class);
>Regards, Will
>William Jaynes | University of Michigan Medical School
>jaynes@umich.edu | 734-763-6751
>---- from log4j-user list -----
>Subject: Re: Tomcat problem (again)
>Using log4j-1.1.1 with Tomcat 3.2.1, putting log4j.jar into WEB-INF/lib
>and log4j.properties into WEB-INF/classes, the static initializer does
>not find log4j.properties. Changing DEFAULT_CONFIGURATION_FILE to
>"/log4j.properties" does not make any difference.   Move
>log4j.properties out to /tomcat/classes, which is on the tomcat
>classpath, and the static initializer finds it. This I would expect.
>Move log4j.jar out to /tomcat/lib, and again log4j.properties is found.
>Move log4j.properties back to WEB-INF/classes and it isn't found.
>All of the above behaviour is expected (by me) except for the first.
>Packaging log4j.jar and log4j.properties into a web application should
>result in the static initializer finding the properties file in the web
>application. In the current release, this does not happen.
>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. ClassLoaders are organized into a hierarchy, and the one fetched
>using Object.class is at an upper level, and therefore won't be able to
>"see" into a web application, each of which has its own ClassLoader.
>Using "Category.class" would at least insure that the properties file is
>searched for using the same class loader as was used to load the
>If I make the change I suggest, then no matter where I put log4j.jar and
>log4j.properties, the behaviour of the static initializer is as I expect
>it to be.
>To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

Ceki Gülcü

To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

View raw message