如何打开tomcat catalina.out文件的调试和信息日志?

时间:2016-05-14 10:57:44

标签: java tomcat logging

当我在tomcat服务器上部署.war文件时,它会自动为每个响应打印调试和信息日志消息。我尝试解决它,但没有办法找到它来自tomcat的位置如果tomcat中有配置文件的任何设置请告诉我停止此消息,因为我的catalina.out文件大小增加了这么多我需要停止

09:54:48.977 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#1'
09:54:48.978 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean '(inner bean)#2'
09:54:49.453 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#2'
09:54:49.454 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean '(inner bean)#3'
09:54:49.696 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#3'
09:54:49.696 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean '(inner bean)#4'
09:54:50.054 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#4'
09:54:50.055 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean '(inner bean)#5'
09:54:50.417 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#5'
09:54:50.418 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean '(inner bean)#6'
09:54:51.135 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#6'
09:54:51.136 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean '(inner bean)#7'
09:54:51.853 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#7'
09:54:51.853 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean '(inner bean)#8'
09:54:54.716 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#8'
09:54:54.831 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0'
09:54:55.370 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0'
09:54:55.370 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.web.servlet.handler.MappedInterceptor#0'
09:54:55.370 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0'
09:54:55.370 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0'
09:54:55.487 [localhost-startStop-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0' to allow for resolving potential circular references
10:06:27.851 [http-nio-8081-exec-10] DEBUG o.s.w.s.m.m.a.HttpEntityMethodProcessor - Written [{"data":{"code":success,"message":{"title":"Title“}}

2 个答案:

答案 0 :(得分:1)

如果您使用的是Tomcat默认日志记录(java.util.Logging),则需要在$ {catalina.base} /conf/logging.properties中配置日志记录级别。

如果您不想查看DEBUG日志,则应指定org.apache.catalina.level = INFO。

有关如何针对各种Log API调整Tomcat日志记录的详细信息,请参阅:https://tomcat.apache.org/tomcat-6.0-doc/logging.html#Using_java.util.logging_(default)

答案 1 :(得分:0)

我面临着同样的问题。我想在春季禁用所有的INFO和DEBUG日志。尝试了很多事情之后,我找到了解决方案。我这样更改了项目的运行配置。
右键单击您的项目-> 运行方式-> 运行配置。左侧中,选择您的 tomcat服务器
右侧中选择 Arguments 标签,并在 VM自变量中编辑或添加以下几行:

-Dcatalina.base =“ C:\ Program Files \ Apache Software Foundation \ Tomcat 8.0” -Dcatalina.home =“ C:\ Program Files \ Apache Software Foundation \ Tomcat 8.0” -Dwtp.deploy =“ C:\ Program Files \ Apache Software Foundation \ Tomcat 8.0 \ wtpwebapps“ -Djava.endorsed.dirs =” C:\ Program Files \ Apache Software Foundation \ Tomcat 8.0 \ endorsed“

注意:根据您的tomcat安装更改这些行。只需将 C:\ Program Files \ 替换为您的tomcat安装路径即可。