Bug 36654 - Provide better error messages for "Please initialize the log4j system properly"
Summary: Provide better error messages for "Please initialize the log4j system properly"
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.2
Hardware: Other other
: P5 minor
Target Milestone: ---
Assignee: log4j-dev
Depends on:
Reported: 2005-09-14 13:18 UTC by Ralf Hauser
Modified: 2006-11-12 05:55 UTC (History)
1 user (show)

LogManager.java.patch (747 bytes, patch)
2005-09-14 13:21 UTC, Ralf Hauser
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Hauser 2005-09-14 13:18:58 UTC
Happens with v. 1.2.9 and 1.2.12

Under Eclipse - Debug, all of a sudden log4j stopped working and I get on the
<<log4j:WARN No appenders could be found for logger (com.domain.test.TestSuite).
log4j:WARN Please initialize the log4j system properly.>>

Ok, I upgraded to log4j-1.3alpha-6.jar and got
<<*** configurationOptionStr=null
** End of LogManager static initializer
log4j:INFO Creating new logger [com.domain.test.TestSuite] in repository
but still no log.debug statements were honoured.

The log4j.properties is in the usual place and has among others the following
log4j.logger.com.domain = DEBUG, stdout

in org.apache.log4j.LogManager of the CVS HEAD, I saw the test for 
String debugProp = System.getProperty("log4j.debug");

but doing 
   System.setProperty("log4j.debug", "true");
in TestSuite.main() is obviously too late if I do as the first statement in the
  static Logger log = Logger.getLogger(TestSuite.class);
Setting this "log4j.debug" variable to true in eclipe's Debug-Environment didn't
make that more verbose either (I'm still hoping to see "**Start of LogManager
static initializer").

Anyway, I went down and finally found the reason - the log4j.properties
apparently also needs to be in a second place.

What I would hope for that log4j would volunteer to say where it was searching
in vane!
Comment 1 Ralf Hauser 2005-09-14 13:21:52 UTC
Created attachment 16403 [details]

This would certainly reduce the "config-problems" noise on the mailing list...
Comment 2 Kay Abendroth 2006-11-11 13:27:26 UTC
Patch doesn't apply correctly! 
Which version should I try to patch it with?

I think this bug is no longer valid.