1
votes

I'm developing web application with Struts2 framework using Apache Tomcat Web server and having some trouble in log4j. First this is my log4j.properties file

log4j.rootLogger=ERROR,L,stdout

log4j.appender.L=org.apache.log4j.DailyRollingFileAppender
log4j.appender.L.File=D:/logs/mct/mctaccess.log

log4j.appender.L.DatePattern=.yyyy-MM-dd
log4j.appender.L.layout=org.apache.log4j.PatternLayout
log4j.appender.L.layout.ConversionPattern=%d %t %5p %c{1}:%L - %m%n

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %t %5p %c{1}:%L - %m%n

log4j.logger.com.mct.access=debug

I define my log in code like this :

 private final static Logger log = Logger.getLogger(ChangeMoneyTransaction.class);

The "ChangeMoneyTransaction" class is under the "com.mct.access" package, and i call my log debug like this :

log.debug("start saving process");

The problem is, it's working fine in my development environment, but not in the production environment. In production environment, it's just showing ERROR log, not the DEBUG log. My question is, does tomcat has capability to override my log4j.properties?

1
"log4j.rootLogger=ERROR" will only display error messages and higher. - Stefan

1 Answers

1
votes

You didn't set the appender for you logger

log4j.logger.com.mct.access=DEBUG,L,stdout