https://issues.apache.org/bugzilla/show_bug.cgi?id=47967

           Summary: log4j.ignoreTCL should apply to the getResource method
                    in addition to the loadClass method of
                    org.apache.log4j.helpers.Loader
           Product: Log4j
           Version: unspecified
          Platform: Other
        OS/Version: AIX
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Configurator
        AssignedTo: [email protected]
        ReportedBy: [email protected]


We have log4j at the extension class loader level as well as at the application
class loader level, and each have their own log4j.properties file.  This worked
fine until we upgraded to a version of log4j that searches the Thread Context
Classloader for log4j.properties.  Log4j at the extension classloader level
started picking up our application's log4j.properties.  We have
log4j.ignoreTCL=true coded, but this did not help.  Looking at the code, it
looks like the loadClass method obeys this setting, but getResource does not. 
To fix this, the section of getResource in org.apache.log4j.helpers.Loader
should be changed from:
...
      if(!java1) {
        classLoader = getTCL();
        if(classLoader != null) {
          LogLog.debug("Trying to find ["+resource+"] using context classloader
"
               +classLoader+".");
...

to this (change is in first line only):

...
      if(!java1 && !ignoreTCL) {
        classLoader = getTCL();
        if(classLoader != null) {
          LogLog.debug("Trying to find ["+resource+"] using context classloader
"
               +classLoader+".");
...

This way setting log4j.ignoreTCL=true would make log4j only load properties
from its current classloader and then also only load classes from the current
classloader.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to