Bug 25747 - more explanations when hitting "WARN No appenders could be found for logger"
more explanations when hitting "WARN No appenders could be found for logger"
Status: RESOLVED FIXED
Product: Log4j
Classification: Unclassified
Component: Configurator
unspecified
Other other
: P3 enhancement
: ---
Assigned To: log4j-dev
http://logging.apache.org/log4j/docs/...
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2003-12-24 15:09 UTC by Ralf Hauser
Modified: 2008-08-12 10:04 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Hauser 2003-12-24 15:09:19 UTC
yes, I know, there is the FAQ and this is a minor thing...
but anyway, it would be great that when hitting
<<log4j:WARN No appenders could be found for logger (com.mydomain.test.app.myTest).
log4j:WARN Please initialize the log4j system properly.>>

To save people a lot of time to figure out to solve this, I suggest:
1) to quote the above URL in that error message
2) to tell the user where you really were looking - absolute path (yes, I know
that class-loading thing is the fault of the Java Guys or those who decided that
different platform have different path names...)
3) in the FAQ, point to configuration section of
http://logging.apache.org/log4j/docs/manual.html or even cite some code snippets
like

PropertyConfigurator.configure(args[0]);
  or 
PropertyConfigurator.configure("log4j.properties"); //relative to 
                                                    //"classpath-root"
Comment 1 Thorbjørn Ravn Andersen 2008-08-02 15:31:21 UTC
I agree, the message should be improved.

However, the most frequent annoyment with log4j I have met is the NEED to have log4j.properties/.xml files and those that linger around when they should have been deleted.

I suggest that the default behaviour in THIS situation is to log a more descriptive message and call BasicConfigurator.configure() to get a plain console appender running.
Comment 2 Curt Arnold 2008-08-12 10:03:44 UTC
Disabling logging when no configuration could be found was a explicit design issue since certain environments (such as Webapps) logging to the console is undesirable.

JDK 1.4 logging has a fallback configuration file that is provided with the JDK, so it never runs into the lack of configuration problem.  log4j 2.0 could possibly delegate to JDK 1.4 logging if no other configuration was found.  Added issue LOG4J2-23 for that.

Added a message pointing to the FAQ, but there is not much that we can easily do to display the class loader's strategy for locating resources.

Committed rev 685228.