Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

log4j log message during log4j initialization

Tags:

log4j

I was trying to setup log4j (xml based) configuration, Use LevelRangeFilter, as described in the official site. Everything is fine so far, except log4j spit out its own log messages till it initializes. After the 'finished configuration' line, everything is normal. Also, there is an error stating "log4j: Could not find root logger information. Is this OK?" .

thanks.

log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Level value for root is  [all].
log4j: root level set to ALL
log4j: Class name: [org.apache.log4j.FileAppender]
log4j: Setting property [file] to [logs/debug.log].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%d{ISO8601}] %-5p %c %m %n].
log4j: Setting property [levelMax] to [DEBUG].
log4j: Setting property [levelMin] to [DEBUG].
log4j: Setting property [acceptOnMatch] to [true].
log4j: Adding filter of type [class org.apache.log4j.varia.LevelRangeFilter] to appender named [debug-out].
log4j: setFile called: logs/debug.log, true
log4j: setFile ended
..................
...................
log4j: Adding appender named [error-out] to category [root].
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Setting property [target] to [System.err].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [[%d{ISO8601}] %-5p %c %m %n].
log4j: Setting property [levelMin] to [INFO].
log4j: Setting property [levelMax] to [FATAL].
log4j: Adding filter of type [class org.apache.log4j.varia.LevelRangeFilter] to appender named [console].
log4j: Adding appender named [console] to category [root].
log4j: Reading configuration from URL file:/C:/Work/test/conf/log4j.xml
log4j: Could not find root logger information. Is this OK?
log4j: Finished configuring.
like image 269
bsr Avatar asked Jul 24 '10 16:07

bsr


People also ask

How does log4j get initialized?

properties file exists at that location, it initializes log4j via the PropertyConfigurator using the log4j. properties file. If the log4j. properties file doesn't exist, the application gets initialized via the BasicConfigurator.

Why do I see a warning about no Appenders found for logger and please configure log4j properly?

Basically the warning No appenders could be found for logger means that you're using log4j logging system, but you haven't added any Appenders (such as FileAppender, ConsoleAppender, SocketAppender, SyslogAppender, etc.) into your configuration file or the configuration file is missing.


1 Answers

In the XML configuration log4j.xml:

<log4j:configuration debug="true" xmlns:log4j='http://jakarta.apache.org/log4j/'>

set the debug attribute to false.

Happy logging :-)

like image 117
misterguy Avatar answered Sep 25 '22 19:09

misterguy