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 2009/04/07 16:40:26 UTC

DO NOT REPLY [Bug 46983] New: More Debug output for log4j auto-configure requested

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

           Summary: More Debug output for log4j auto-configure requested
           Product: Log4j
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Configurator
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: daniel.armbrust.list@gmail.com


I recently spent a too much time trying to figure out why I was getting log4j
"no appenders found" warning messages out of some of my webapps - even though
my webapps dynamically configure log4j.

In the end, the problem was some of my third party jar files were trying to log
something earlier in the startup sequence than when my dynamic log4j
configuration occurred.

What should have been happening was log4j should have found my bootstrap
log4j.properties file, and used that until my "real" configuration happened. 
But in some cases, it wasn't - and even with log4j in full debug mode, I wasn't
seeing why.

It turned out that another webapp was setting this system variable: 
log4j.defaultInitOverride=true - which globally disabled auto configure for
every webapp on the server.

I would like to suggest the following change to the static init block in
LogManager.java:

// if there is no default init override, then get the resource
// specified by the user or the default config file.
if(override == null || "false".equalsIgnoreCase(override)) {

<autoconfigure stuff>

}
//NEW CODE
else if (LogLog.debugEnabled)
{
    LogLog.debug("Not autoconfiguring log4j because the system variable " +
DEFAULT_INIT_OVERRIDE_KEY + " is set.";
}
//END OF NEW CODE

-- 
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