記錄一個小問題,相信有很多用spring boot開發的小伙伴都出現過如圖一的錯誤。因為先入為主的因素導致在日志級別為DEBUG級別時,打印了如例2所示的日志,以為是一個報錯信息,資訊閱讀日志發現是一下系列的匹配流程。
這邊簡單記錄一下解決的方案,如果在沒有更換默認日志的情況下,
可以在application.yml配置:
logging:
level:
org:
springframework:
boot:
autoconfigure: error ###可以是info或者error
同樣可以在application.properties中配置
logging.level.org.springframework.boot.autoconfigure=error #可以是info或者error
如果更換了日志框架,且恰好為log4j,則可以在log4j.properties中添加一個配置:
log4j.logger.org.springframework.boot.autoconfigure=ERROR
例1:
**************************************
APPLICATION FAILED TO START
***************************************
例2:
============================
CONDITIONS EVALUATION REPORT
============================
Positive matches:
-----------------
AopAutoConfiguration matched:
- @ConditionalOnProperty (spring.aop.auto=true) matched (OnPropertyCondition)
AopAutoConfiguration.ClassProxyingConfiguration matched:
- @ConditionalOnMissingClass did not find unwanted class 'org.aspectj.weaver.Advice' (OnClassCondition)
- @ConditionalOnProperty (spring.aop.proxy-target-class=true) matched (OnPropertyCondition)
DataSourceAutoConfiguration matched:
- @ConditionalOnClass found required classes 'javax.sql.DataSource', 'org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType' (OnClassCondition)
- @ConditionalOnMissingBean (types: io.r2dbc.spi.ConnectionFactory; SearchStrategy: all) did not find any beans (OnBeanCondition)
DataSourceConfiguration.Generic matched:
- @ConditionalOnProperty (spring.datasource.type) matched (OnPropertyCondition)