logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47967] New: log4j.ignoreTCL should apply to the getResource method in addition to the loadClass method of org.apache.log4j.helpers.Loader
Date Thu, 08 Oct 2009 20:18:21 GMT
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: log4j-dev@logging.apache.org
        ReportedBy: vonnahme.paul@principal.com


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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message