bsr
bsr

Reputation: 58662

log4j log message during log4j initialization

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.

Upvotes: 5

Views: 5306

Answers (2)

misterguy
misterguy

Reputation: 96

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 :-)

Upvotes: 8

panagdu
panagdu

Reputation: 2133

You should add something similar to your .xml file.

<root>
        <priority value="DEBUG"/>
        <appender-ref ref="debug-out"/>
</root>

Upvotes: 0

Related Questions