问题

当我启动Tomcat时,我收到以下错误:

Jun 10, 2010 5:17:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Jun 10, 2010 5:17:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/mywebapplication] startup failed due to previous errors

Tomcat的日志不包含堆栈跟踪似乎很奇怪。是否有人建议如何增加Tomcat中的日志记录以获取此类错误的堆栈跟踪?


#1 热门回答(132 赞)

检查Tomcat创建的localhost_yyyy_mm_dd.logORlocalhost.yyyy-mm-dd.log日志,这些日志通常存储该类型的信息。我不希望将完整的堆栈跟踪转储到标准输出。


#2 热门回答(79 赞)

在WEB-INF / classes中创建一个名为logging.properties的文件,其中包含以下内容:

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

#3 热门回答(20 赞)

Tomcat会记录堆栈跟踪,但是当从IDE启动tomcat时,并不总是清楚日志文件的位置。当我从IntelliJ启动时,CATALINA_BASE设置为${home}/.IntelliJIdea10/system/tomcat/Unnamed_r6-idea,日志文件位于in[CATALINA_BASE]/logs

要查看日志,请找到日志文件,或编辑[CATALINA_HOME]/conf/logging.properties以将tomcat logger输出定向到控制台。下面我为默认的tomcat配置添加了第二个处理程序:

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

现在,完整的堆栈跟踪出现在IntelliJ输出中:

Dec 27, 2011 12:02:45 PM org.apache.catalina.core.StandardContext filterStart
 SEVERE: Exception starting filter filterChainProxy
 org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'filterChainProxy' is defined   at
 org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529)
 . . .

原文链接