Can someone help me configuring log 4j. I am using eclipse and the application is a gwt app. Whenever, i'm starting web app, it is displaying
log4j:WARN No appenders could be found for logger (org.apache.jasper.compiler.JspRuntimeContext).
log4j:WARN Please initialize the log4j system properly.
I have placed log4j.propeties file in src of the gwt application. The log4j.propeties file contains:
# Set root logger level to DEBUG and its only appender to Appender1.
log4j.rootLogger=INFO, Appender1,Appender2
# Appender1 is set to be a ConsoleAppender.
log4j.appender.Appender1=org.apache.log4j.ConsoleAppender
log4j.appender.Appender2=org.apache.log4j.RollingFileAppender
log4j.appender.Appender2.File=sample.log
# Appender2 uses PatternLayout.
log4j.appender.Appender1.layout=org.apache.log4j.PatternLayout
log4j.appender.Appender1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
log4j.appender.Appender2.layout=org.apache.log4j.PatternLayout
log4j.appender.Appender2.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Can someone help??
If you really named it
"log4j.propeties" instead of
"log4j.properties", then this may be the reason.
You need to ensure that log4j.properties is found on the classpath of your web app. A typical place for it is WEB-INF/classes. If you put your file under src
, Eclipse may deploy it into WEB-INF/classes
, but it is worth double checking.
You also need to add logger configuration to determine which packages/classes are to log to which appender. E.g.
log4j.logger.org.apache=WARN
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