You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2004/01/22 14:01:00 UTC

DO NOT REPLY [Bug 26345] New: - Loader always uses ContextClassLoader for getting Ressources

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26345>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26345

Loader always uses ContextClassLoader for getting Ressources

           Summary: Loader always uses ContextClassLoader for getting
                    Ressources
           Product: Log4j
           Version: 1.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Configurator
        AssignedTo: log4j-dev@jakarta.apache.org
        ReportedBy: kdk11@gmx.de


In method org.apache.log4j.helpers.Loader.getResource(String resource)
the resource is always searched at first using the context class loader. 
The variable ignoreTCL is ignored, so setting the system property 
"log4j.ignoreTCL" has no effect. I consider this as a bug and suggest 
to change the behaviour. Following cvs diff would fix the problem:

cvs diff Loader.java (in directory
E:\billi\cvs_rep\logging\logging-log4j\src\java\org\apache\log4j\helpers\)
Index: Loader.java
===================================================================
RCS file:
/home/cvspublic/logging-log4j/src/java/org/apache/log4j/helpers/Loader.java,v
retrieving revision 1.19
diff -r1.19 Loader.java
120c120
<       if (!java1) {
---
>       if (! (java1 || ignoreTCL) {


Rational:
We are using Log4J inside our library. To avoid conflicts with 3rd party libs
our library creates a classloader responsible for loading our implementation
and all 3rd Party libs used in our implementation (like log4j). If the using
application of our library is also using Log4J and places a configuration
file in the classpath (log4j.properties or log4j.xml) our instance of log4j will
be configured by this file.

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