减少应用程序用SpringMVC
问题描述:
生成的日志我有一个3用SpringMVC应用程序,它使用了Spring的安全,AOP,Hibernate等等减少应用程序用SpringMVC
但是,当我在Tomcat或码头运行它,它会产生一个巨大的日志量。
如何减少此日志?
我想要一个从WARNING
开始的日志级别。日志
例子:
21:16:08.393 [qtp12506312-25] DEBUG o.s.s.w.s.HttpSessionEventPublisher - Publishing event: org.springframework.security.web.session.HttpSessi onCreatedEvent[source=org.eclipse.jetty.server.session.HashedSess ion:[email protected]]
21:16:08.394 [qtp12506312-25] DEBUG o.s.s.w.s.HttpSessionRequestCache - DefaultSavedRequest added to Session: DefaultSavedRequest[http://xx.xx.xx.xx:8080/favicon.ico]
21:16:08.394 [qtp12506312-25] DEBUG o.s.s.w.a.ExceptionTranslationFilter - Calling Authentication entry point.
21:16:08.440 [qtp12506312-25] DEBUG o.s.s.web.DefaultRedirectStrategy - Redirecting to 'http://xx.xx.xx.xx:8080/default;jsessionid=db7nzoxke45es1k02gbug79d'
21:16:08.441 [qtp12506312-25] DEBUG o.s.s.w.c.HttpSessionSecurityContextRepository - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
21:16:08.441 [qtp12506312-25] DEBUG o.s.s.w.c.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed
21:16:08.518 [qtp12506312-26] DEBUG o.s.s.web.util.AntPathRequestMatcher - Checking match of request : '/default'; against '/loginform.jsp'
21:16:08.518 [qtp12506312-26] DEBUG o.s.s.web.util.AntPathRequestMatcher - Checking match of request : '/default'; against '/loginform2.jsp'
21:16:08.518 [qtp12506312-26] DEBUG o.s.s.web.util.AntPathRequestMatcher - Checking match of request : '/default'; against '/default'
21:16:08.518 [qtp12506312-26] DEBUG o.s.security.web.FilterChainProxy - /default has an empty filter list
答
如果使用的logback用于记录则根记录的日志杆改为警告,你可以找到在classpath
EX中logback.xml文件:
<root level="WARN">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
如果您使用的是log4j,则可以在您的类路径中找到log4j.properties文件。将rootlogger级别更改为WARNING
log4j.rootLogger=WARNING , A1
这是使用的日志框架log4j/logback – 2013-05-10 05:01:11