spring 如何从Sping Boot 应用程序的控制台中排除条件评估报告?

tcomlyy6  于 2022-12-02  发布在  Spring
关注(0)|答案(4)|浏览(168)

当我运行我的Sping Boot 应用程序时,我在我的控制台日志中得到条件评估报告。
如何在Sping Boot 中从控制台日志中禁用或排除此报告?

============================
CONDITIONS EVALUATION REPORT
============================

Positive matches:
-----------------

   AopAutoConfiguration matched:
      - @ConditionalOnClass found required classes 'org.springframework.context.annotation.EnableAspectJAutoProxy', 'org.aspectj.lang.annotation.Aspect', 'org.aspectj.lang.reflect.Advice', 'org.aspectj.weaver.AnnotatedElement'; @ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
      - @ConditionalOnProperty (spring.aop.auto=true) matched (OnPropertyCondition)

   AopAutoConfiguration.CglibAutoProxyConfiguration matched:
      - @ConditionalOnProperty (spring.aop.proxy-target-class=true) matched (OnPropertyCondition)

   CacheAutoConfiguration matched:
      - @ConditionalOnClass found required class 'org.springframework.cache.CacheManager'; @ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
      - @ConditionalOnBean (types: org.springframework.cache.interceptor.CacheAspectSupport; SearchStrategy: all) found bean 'cacheInterceptor'; @ConditionalOnMissingBean (names: cacheResolver; types: org.springframework.cache.CacheManager; SearchStrategy: all) did not find any beans (OnBeanCondition)

...
6ljaweal

6ljaweal1#

可以通过更改org.springframework.boot.autconfigure的日志级别来实现此目的。例如,在application.properties中添加以下行:

logging.level.org.springframework.boot.autoconfigure=ERROR
piok6c0g

piok6c0g2#

如果您符合以下条件,您将获得病情结果报告:

  • 将IDE配置为显示调试输出(例如,如果在IntelliJ中的Sping Boot 运行配置中设置Enable debug output)。
  • 在application.properties中设置属性debug=true
  • org.springframework.boot.autoconfigure.logging的日志记录级别设置为DEBUG

当您试图找出某些Bean未被加载的原因时,这可能很有用,因为通过此报告,您可以准确地看到哪些自动配置正在被加载,哪些没有被加载(以及原因)。
您可以通过撤消前面提到的要点来禁用此输出。例如,您可以将org.springframework.boot.autoconfigure.logging的日志记录级别设置为INFO

logging.level.org.springframework.boot.autoconfigure.logging=INFO
dgiusagp

dgiusagp3#

other answer工作时,也可以将日志级别设置为INFO

logging.level.org.springframework.boot.autoconfigure=INFO
wmvff8tz

wmvff8tz4#

只需将以下内容添加到application.yml

logging:
  level:
    ROOT: INFO
    you/package/path: INFO

相关问题