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.
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.
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.
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 :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With