Log4J display this warning message when Log4j Java code is searching to create a first log line in your program.
At this moment, Log4j make 2 things
log4j.properties
filelog4j.properties
If log4J
doesn't find log4j.properties
file or if appender declared in log4j.rootlogger
are not defined elsewhere in log4j.properties
file the warning message is displayed.
CAUTION: the content of Properties file must be correct.
The following content is NOT correct
log4j.rootLogger=file
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=c:/Trace/MsgStackLogging.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%m%n
log4j.appender.FILE.ImmediateFlush=true
log4j.appender.FILE.Threshold=debug
log4j.appender.FILE.Append=false
because file
appender is declared in LOWER-CASE in log4j.rootlogger
statement and defined in log4j.appender statement using UPPER-CASE !
A correct file would be
log4j.rootLogger=FILE
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=c:/Trace/MsgStackLogging.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%m%n
log4j.appender.FILE.ImmediateFlush=true
log4j.appender.FILE.Threshold=debug
log4j.appender.FILE.Append=false
If MAVEN is used, you must put log4j.properties files in src/main/resources
AND start a MAVEN build.
Log4j.properties file is then copied in target/classes
folder.
Log4J use the log4j.properties
file that it found in target/classes
!