2016-01-21 57 views
2
部署调试日志

我有上百个日志中部署我的春天启动的应用程序在Tomcat 7.示例:如何关闭春

... 
13:08:23.361 [http-apr-8080-exec-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'metaDataSourceAdvisor' 
13:08:23.375 [http-apr-8080-exec-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'requestMappingHandlerAdapter' 
13:08:23.375 [http-apr-8080-exec-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'mvcConversionService' 
13:08:23.375 [http-apr-8080-exec-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'mvcPathMatcher' 
13:08:23.375 [http-apr-8080-exec-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'mvcUrlPathHelper' 
13:08:23.376 [http-apr-8080-exec-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'mvcUriComponentsContributor' 
13:08:23.376 [http-apr-8080-exec-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'mvcUriComponentsContributor' 
13:08:23.376 [http-apr-8080-exec-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration' 
... 

,其中来自这些日志的起源和如何关闭调试任何想法日志类型?我试着:

  • 集log4j的属性文件log4j.rootLogger=INFO,但我想日志没有从log4j的
  • 集com.my.app.level来到= INFO

pom.xml

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.3.0.RELEASE</version> 
</parent> 
<dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-security</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-ldap</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-jpa</artifactId> 
    </dependency> 

    <!-- deploy on tomcat --> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-tomcat</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <!-- /deploy on tomcat --> 
</dependencies> 

我也越来越调试日志在控制台应用程序时工作

14:31:12.034 [http-apr-8080-exec-6] DEBUG o.s.s.web.DefaultRedirectStrategy - Redirecting to 'http://localhost:8080/myapp/login' 
14:31:12.034 [http-apr-8080-exec-6] DEBUG o.s.s.w.c.HttpSessionSecurityContextRepository - SecurityContext is empty or contents are anonymous - context will not 
be stored in HttpSession. 
14:31:12.035 [http-apr-8080-exec-6] DEBUG o.s.s.w.c.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed 
14:31:12.038 [http-apr-8080-exec-7] DEBUG o.s.security.web.FilterChainProxy - /login at position 1 of 13 in additional filter chain; firing Filter: 'WebAsyncMan 
agerIntegrationFilter' 
14:31:12.039 [http-apr-8080-exec-7] DEBUG o.s.security.web.FilterChainProxy - /login at position 2 of 13 in additional filter chain; firing Filter: 'SecurityCon 
textPersistenceFilter' 
14:31:12.040 [http-apr-8080-exec-7] DEBUG o.s.s.w.c.HttpSessionSecurityContextRepository - HttpSession returned null object for SPRING_SECURITY_CONTEXT 
14:31:12.040 [http-apr-8080-exec-7] DEBUG o.s.s.w.c.HttpSessionSecurityContextRepository - No SecurityContext was available from the HttpSession: org.apache.cat 
[email protected] A new one will be created. 
14:31:12.041 [http-apr-8080-exec-7] DEBUG o.s.security.web.FilterChainProxy - /login at position 3 of 13 in additional filter chain; firing Filter: 'HeaderWrite 
rFilter' 

回答

0

根据您的依赖关系,我可以说您使用的是Logback,而不是Log4j。您可以添加到您的application.properties关闭春天DEBUG日志:

logging.level.org.springframework = INFO 

About the logging framework:

默认情况下,如果你使用了“启动多金属氧酸盐”,的logback将用于 记录。还包括适当的Logback路由,以确保使用Java Util日志记录,Commons日志记录,Log4J 或SLF4J的依赖库都能正常工作。

+0

我在我的'application.properties'中添加了这个,但它没有帮助。 – xto

+0

我试图在logging.properties中添加这个,但结果是一样的。当我在控制器'.debug()','.info()','.warn()'里面调用Logger时,它会起作用(仅显示INFO,WARN等)。 – xto

+0

尝试'logging.level.root = INFO' –