2016-01-21 53 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' –