log4j不打印异常的堆栈跟踪
我在tomcat中使用log4j。当我在JSP中记录异常时,servlet: private Logger _log = Logger.getLogger(this.getClass()); ... try{...} catch (Exception e) { _log.error("Error refreshing all prices", e); } 我只得到异常的第一行,没有堆栈跟踪。 17-Feb 17:37:45错误AutoContrib:175-发布csv文件时发生异常:java.lang.ArrayIndexOutOfBoundsException 根本不是很有帮助! 我的log4j.properties文件(/tomcat/common/classes/log4j.properties)看起来像这样: log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{dd-MMM HH:mm:ss} %5p %c{1}:%L - %m%n log4j.appender.stdout.threshold=info log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.maxFileSize=5000KB log4j.appender.file.maxBackupIndex=10 log4j.appender.file.File=${catalina.home}/logs/web.log log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{dd-MMM HH:mm:ss} %5p %c{1}:%L - %m%n log4j.appender.file.threshold=info log4j.rootLogger=debug, stdout, file