Thursday, 15 October 2009
How does log4j load the config files ?
trace file :
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@11b86e7.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@11b86e7 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@11b86e7.
log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader@11b86e7 class loader.
log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
ControlListener Created
Links :
http://jaitechwriteups.blogspot.com/2006/07/know-how-log4j-tries-to-configure.html
http://jaikiran.wordpress.com/2006/07/05/i-get-log4jwarn-no-appenders-could-be-found-for-logger-message-2/
Saturday, 22 November 2008
How to enable Log4j logging in Eclipse console window?
Problems:
Could not see the log message in eclipse console window but it shows following warning message
log4j:WARN No appenders could be found for logger (com.test.HelloWorld).
log4j:WARN Please initialize the log4j system properly.
Reasons:
Log4j is not initialised.
Solution:
Add a ConsoleAppender
or Appender
Code Sample:
BasicConfigurator.configure();
or
PropertyConfigurator.configure("log4j.xml");
Ref:
Log4j Manual
Log4j API
BasicConfigurator
PropertyConfigurator
Thursday, 20 November 2008
Log4j warning message [log4j:WARN No appenders could be found for logger]
Log4j:
Log4j is a logging or tracing API, large number of applications and framework use Log4j for logging.
Problems:
Sometimes application do not generate log files and generate the following warning message.
log4j:WARN Please initialize the log4j system properly.
Log4j is not initialised properly. The Log4j library files are in application class path but Log4j configuration file is not in application class path.
Add log4j configuration file [log4j.properties or log4j.xml] to class path.
More Info:
Log4j priority order
FATAL: 50000
ERROR: 40000
WARN: 30000
INFO: 20000
DEBUG: 10000
log4j Manual
log4j API