Bug 46983 - More Debug output for log4j auto-configure requested
Summary: More Debug output for log4j auto-configure requested
Status: NEW
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Configurator (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement
Target Milestone: ---
Assignee: log4j-dev
Depends on:
Reported: 2009-04-07 07:40 UTC by Dan Armbrust
Modified: 2009-04-07 07:40 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Dan Armbrust 2009-04-07 07:40:24 UTC
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>

else if (LogLog.debugEnabled)
    LogLog.debug("Not autoconfiguring log4j because the system variable " + DEFAULT_INIT_OVERRIDE_KEY + " is set.";