This is where I'm at.  It's not working.

I have a log4j.properties file in tomcat/conf which has these lines:

   log4j.appender.tomcat = org.apache.log4j.RollingFileAppender
   log4j.appender.tomcat.File = ${catalina.base}/logs/tomcat.log
   log4j.appender.tomcat.MaxFileSize = 10MB
   log4j.appender.tomcat.MaxBackupIndex = 10
   log4j.appender.tomcat.layout = org.apache.log4j.PatternLayout
   log4j.appender.tomcat.layout.ConversionPattern = %p %t %c - %m%n
   log4j.rootLogger = INFO, tomcat


Then I have another log4j.properties in my WEB-INF/classes folder with these lines:

   log4j.appender.console = org.apache.log4j.ConsoleAppender
   log4j.appender.console.layout = org.apache.log4j.PatternLayout
   log4j.appender.console.layout.ConversionPattern = %p %t %c - %m%n
   log4j.logger.myapp = DEBUG, console


All my page and other packages begin with "myapp".

When I try to log something using "info", it does show up in the tomcat.log file. However, it does not show up on the console like I would like it to. When I moved the lines from that file into the tomcat/conf/log4j.properties file, it all worked fine. So basically, my WEB-INDF/classes/log4j.properties file is being ignored.

Why is my log4j.properties file being ignored? I even have its location specified in my web.xml file.

What's going on?

Thanks.

--
Tim Koop
<mailto:t...@timkoop.com>
On 16/04/2010 3:05 PM, Peter Stavrinides wrote:
You need a log4j.properties file in $CATALINA_HOME/lib
Or in the classes directory at runtime... to ensure its always in the right 
place simply put the log4j.properties or log4j.xml file is in the 
src/main/resources root folder.

regards,
Peter

Reply via email to