1. 程式人生 > 實用技巧 >springboot2啟動資訊去除CONDITIONS EVALUATION REPORT後引發的思考

springboot2啟動資訊去除CONDITIONS EVALUATION REPORT後引發的思考

前言

最近啟動一個springboot2.2+版本專案時,發現控制檯輸出

17:22:05 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.cloud.util.random.CachedRandomPropertySourceAutoConfiguration'
17:22:05 [main] DEBUG o.s.b.a.l.ConditionEvaluationReportLoggingListener - 


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


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

   ConfigurationPropertiesRebinderAutoConfiguration matched:
      - @ConditionalOnBean (types: org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor; SearchStrategy: all) found bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesBeans matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesBeans; SearchStrategy: current) did not find any beans (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesRebinder matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder; SearchStrategy: current) did not find any beans (OnBeanCondition)

   EncryptionBootstrapConfiguration matched:
      - @ConditionalOnClass found required class 'org.springframework.security.crypto.encrypt.TextEncryptor' (OnClassCondition)

   PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer matched:
      - @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) did not find any beans (OnBeanCondition)


Negative matches:
-----------------

   EncryptionBootstrapConfiguration.RsaEncryptionConfiguration:
      Did not match:
         - Keystore nor key found in Environment (EncryptionBootstrapConfiguration.KeyCondition)
      Matched:
         - @ConditionalOnClass found required class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)

   EncryptionBootstrapConfiguration.VanillaEncryptionConfiguration:
      Did not match:
         - @ConditionalOnMissingClass found unwanted class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)

   EurekaDiscoveryClientConfigServiceBootstrapConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.cloud.config.client.ConfigServicePropertySourceLocator' (OnClassCondition)


Exclusions:
-----------

    None


Unconditional classes:
----------------------

    None



17:22:13 [main] DEBUG o.s.b.c.l.ClasspathLoggingApplicationListener - Application started with classpath: [file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/charsets.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/deploy.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/access-bridge-64.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/cldrdata.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/dnsns.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/jaccess.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/jfxrt.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/localedata.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/nashorn.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunec.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunjce_provider.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunmscapi.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunpkcs11.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/zipfs.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/javaws.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jce.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jfr.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jfxswt.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jsse.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/management-agent.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/plugin.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/resources.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/rt.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-biz/target/classes/, file:/D:/repository/org/springframework/boot/spring-boot-starter/2.2.5.RELEASE/spring-boot-starter-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot/2.2.5.RELEASE/spring-boot-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-logging/2.2.5.RELEASE/spring-boot-starter-logging-2.2.5.RELEASE.jar, file:/D:/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/D:/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/D:/repository/org/apache/logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar, file:/D:/repository/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar, file:/D:/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar, file:/D:/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar, file:/D:/repository/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar, file:/D:/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar, file:/D:/repository/org/springframework/spring-core/5.2.4.RELEASE/spring-core-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-jcl/5.2.4.RELEASE/spring-jcl-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-web/2.2.5.RELEASE/spring-boot-starter-web-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-json/2.2.5.RELEASE/spring-boot-starter-json-2.2.5.RELEASE.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-databind/2.10.2/jackson-databind-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.2/jackson-datatype-jdk8-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.2/jackson-datatype-jsr310-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.2/jackson-module-parameter-names-2.10.2.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-tomcat/2.2.5.RELEASE/spring-boot-starter-tomcat-2.2.5.RELEASE.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.31/tomcat-embed-core-9.0.31.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.31/tomcat-embed-el-9.0.31.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.31/tomcat-embed-websocket-9.0.31.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-validation/2.2.5.RELEASE/spring-boot-starter-validation-2.2.5.RELEASE.jar, file:/D:/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar, file:/D:/repository/org/hibernate/validator/hibernate-validator/6.0.18.Final/hibernate-validator-6.0.18.Final.jar, file:/D:/repository/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar, file:/D:/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar, file:/D:/repository/org/springframework/spring-web/5.2.4.RELEASE/spring-web-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-beans/5.2.4.RELEASE/spring-beans-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-webmvc/5.2.4.RELEASE/spring-webmvc-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-aop/5.2.4.RELEASE/spring-aop-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-context/5.2.4.RELEASE/spring-context-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-expression/5.2.4.RELEASE/spring-expression-5.2.4.RELEASE.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-api/target/classes/, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-openfeign/2.2.2.RELEASE/spring-cloud-starter-openfeign-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-openfeign-core/2.2.2.RELEASE/spring-cloud-openfeign-core-2.2.2.RELEASE.jar, file:/D:/repository/io/github/openfeign/form/feign-form-spring/3.8.0/feign-form-spring-3.8.0.jar, file:/D:/repository/io/github/openfeign/form/feign-form/3.8.0/feign-form-3.8.0.jar, file:/D:/repository/commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar, file:/D:/repository/commons-io/commons-io/2.6/commons-io-2.6.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-commons/2.2.2.RELEASE/spring-cloud-commons-2.2.2.RELEASE.jar, file:/D:/repository/io/github/openfeign/feign-core/10.7.4/feign-core-10.7.4.jar, file:/D:/repository/io/github/openfeign/feign-slf4j/10.7.4/feign-slf4j-10.7.4.jar, file:/D:/repository/io/github/openfeign/feign-hystrix/10.7.4/feign-hystrix-10.7.4.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-common/nisbos-rpc-framework/target/classes/, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-common/nisbos-common-trace/target/classes/, file:/D:/repository/org/springframework/boot/spring-boot-configuration-processor/2.2.5.RELEASE/spring-boot-configuration-processor-2.2.5.RELEASE.jar, file:/D:/repository/com/dianping/cat/cat-client/3.0.0/cat-client-3.0.0.jar, file:/D:/repository/com/ctrip/framework/apollo/apollo-client/1.6.0/apollo-client-1.6.0.jar, file:/D:/repository/com/ctrip/framework/apollo/apollo-core/1.6.0/apollo-core-1.6.0.jar, file:/D:/repository/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar, file:/D:/repository/org/mybatis/mybatis/3.5.3/mybatis-3.5.3.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-common/target/classes/, file:/D:/repository/org/apache/shiro/shiro-core/1.5.3/shiro-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-lang/1.5.3/shiro-lang-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-cache/1.5.3/shiro-cache-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-hash/1.5.3/shiro-crypto-hash-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-core/1.5.3/shiro-crypto-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-cipher/1.5.3/shiro-crypto-cipher-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-config-core/1.5.3/shiro-config-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-config-ogdl/1.5.3/shiro-config-ogdl-1.5.3.jar, file:/D:/repository/commons-beanutils/commons-beanutils/1.9.4/commons-beanutils-1.9.4.jar, file:/D:/repository/org/apache/shiro/shiro-event/1.5.3/shiro-event-1.5.3.jar, file:/D:/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/D:/repository/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar, file:/D:/repository/com/baomidou/mybatis-plus-boot-starter/3.3.1/mybatis-plus-boot-starter-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus/3.3.1/mybatis-plus-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-extension/3.3.1/mybatis-plus-extension-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-core/3.3.1/mybatis-plus-core-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-annotation/3.3.1/mybatis-plus-annotation-3.3.1.jar, file:/D:/repository/com/github/jsqlparser/jsqlparser/3.1/jsqlparser-3.1.jar, file:/D:/repository/org/mybatis/mybatis-spring/2.0.3/mybatis-spring-2.0.3.jar, file:/D:/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.5.RELEASE/spring-boot-autoconfigure-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-jdbc/2.2.5.RELEASE/spring-boot-starter-jdbc-2.2.5.RELEASE.jar, file:/D:/repository/com/zaxxer/HikariCP/3.4.2/HikariCP-3.4.2.jar, file:/D:/repository/org/springframework/spring-jdbc/5.2.4.RELEASE/spring-jdbc-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-tx/5.2.4.RELEASE/spring-tx-5.2.4.RELEASE.jar, file:/D:/repository/mysql/mysql-connector-java/8.0.19/mysql-connector-java-8.0.19.jar, file:/D:/repository/com/alibaba/druid/1.0.28/druid-1.0.28.jar, file:/F:/soft/jdk/jdk1.8.0_241/lib/jconsole.jar, file:/F:/soft/jdk/jdk1.8.0_241/lib/tools.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-eureka-client/2.2.2.RELEASE/spring-cloud-starter-netflix-eureka-client-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter/2.2.2.RELEASE/spring-cloud-starter-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/security/spring-security-rsa/1.0.9.RELEASE/spring-security-rsa-1.0.9.RELEASE.jar, file:/D:/repository/org/bouncycastle/bcpkix-jdk15on/1.64/bcpkix-jdk15on-1.64.jar, file:/D:/repository/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-hystrix/2.2.2.RELEASE/spring-cloud-netflix-hystrix-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-aop/2.2.5.RELEASE/spring-boot-starter-aop-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-eureka-client/2.2.2.RELEASE/spring-cloud-netflix-eureka-client-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/eureka/eureka-client/1.9.17/eureka-client-1.9.17.jar, file:/D:/repository/org/codehaus/jettison/jettison/1.3.7/jettison-1.3.7.jar, file:/D:/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-eventbus/0.3.0/netflix-eventbus-0.3.0.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-infix/0.3.0/netflix-infix-0.3.0.jar, file:/D:/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar, file:/D:/repository/joda-time/joda-time/2.10.5/joda-time-2.10.5.jar, file:/D:/repository/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar, file:/D:/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar, file:/D:/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/D:/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar, file:/D:/repository/com/netflix/archaius/archaius-core/0.7.6/archaius-core-0.7.6.jar, file:/D:/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar, file:/D:/repository/com/netflix/servo/servo-core/0.12.21/servo-core-0.12.21.jar, file:/D:/repository/com/sun/jersey/jersey-core/1.19.1/jersey-core-1.19.1.jar, file:/D:/repository/com/sun/jersey/jersey-client/1.19.1/jersey-client-1.19.1.jar, file:/D:/repository/com/sun/jersey/contribs/jersey-apache-client4/1.19.1/jersey-apache-client4-1.19.1.jar, file:/D:/repository/org/apache/httpcomponents/httpclient/4.5.12/httpclient-4.5.12.jar, file:/D:/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar, file:/D:/repository/commons-codec/commons-codec/1.14/commons-codec-1.14.jar, file:/D:/repository/com/google/inject/guice/4.1.0/guice-4.1.0.jar, file:/D:/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/D:/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotations-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2.jar, file:/D:/repository/com/netflix/eureka/eureka-core/1.9.17/eureka-core-1.9.17.jar, file:/D:/repository/com/fasterxml/woodstox/woodstox-core/5.0.3/woodstox-core-5.0.3.jar, file:/D:/repository/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-archaius/2.2.2.RELEASE/spring-cloud-starter-netflix-archaius-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-archaius/2.2.2.RELEASE/spring-cloud-netflix-archaius-2.2.2.RELEASE.jar, file:/D:/repository/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-ribbon/2.2.2.RELEASE/spring-cloud-starter-netflix-ribbon-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/ribbon/ribbon/2.3.0/ribbon-2.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-transport/2.3.0/ribbon-transport-2.3.0.jar, file:/D:/repository/io/reactivex/rxnetty-contexts/0.4.9/rxnetty-contexts-0.4.9.jar, file:/D:/repository/io/reactivex/rxnetty-servo/0.4.9/rxnetty-servo-0.4.9.jar, file:/D:/repository/io/reactivex/rxnetty/0.4.9/rxnetty-0.4.9.jar, file:/D:/repository/com/netflix/ribbon/ribbon-core/2.3.0/ribbon-core-2.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-httpclient/2.3.0/ribbon-httpclient-2.3.0.jar, file:/D:/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-commons-util/0.3.0/netflix-commons-util-0.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-loadbalancer/2.3.0/ribbon-loadbalancer-2.3.0.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar, file:/D:/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-loadbalancer/2.2.2.RELEASE/spring-cloud-starter-loadbalancer-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-loadbalancer/2.2.2.RELEASE/spring-cloud-loadbalancer-2.2.2.RELEASE.jar, file:/D:/repository/io/projectreactor/reactor-core/3.3.3.RELEASE/reactor-core-3.3.3.RELEASE.jar, file:/D:/repository/io/projectreactor/addons/reactor-extra/3.3.2.RELEASE/reactor-extra-3.3.2.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-cache/2.2.5.RELEASE/spring-boot-starter-cache-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/spring-context-support/5.2.4.RELEASE/spring-context-support-5.2.4.RELEASE.jar, file:/D:/repository/com/stoyanr/evictor/1.0.0/evictor-1.0.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-eureka/2.3.0/ribbon-eureka-2.3.0.jar, file:/D:/repository/com/thoughtworks/xstream/xstream/1.4.12/xstream-1.4.12.jar, file:/D:/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/D:/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-hystrix/2.2.2.RELEASE/spring-cloud-starter-netflix-hystrix-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-ribbon/2.2.2.RELEASE/spring-cloud-netflix-ribbon-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/hystrix/hystrix-core/1.5.18/hystrix-core-1.5.18.jar, file:/D:/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar, file:/D:/repository/com/netflix/hystrix/hystrix-serialization/1.5.18/hystrix-serialization-1.5.18.jar, file:/D:/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.10.2/jackson-module-afterburner-2.10.2.jar, file:/D:/repository/com/netflix/hystrix/hystrix-metrics-event-stream/1.5.18/hystrix-metrics-event-stream-1.5.18.jar, file:/D:/repository/com/netflix/hystrix/hystrix-javanica/1.5.18/hystrix-javanica-1.5.18.jar, file:/D:/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar, file:/D:/repository/org/aspectj/aspectjweaver/1.9.5/aspectjweaver-1.9.5.jar, file:/D:/repository/com/google/guava/guava/28.2-android/guava-28.2-android.jar, file:/D:/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar, file:/D:/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar, file:/D:/repository/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar, file:/D:/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar, file:/D:/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar, file:/D:/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar, file:/D:/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-actuator/2.2.5.RELEASE/spring-boot-starter-actuator-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.2.5.RELEASE/spring-boot-actuator-autoconfigure-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-actuator/2.2.5.RELEASE/spring-boot-actuator-2.2.5.RELEASE.jar, file:/D:/repository/io/micrometer/micrometer-core/1.3.5/micrometer-core-1.3.5.jar, file:/D:/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar, file:/D:/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-context/2.2.3.RELEASE/spring-cloud-context-2.2.3.RELEASE.jar, file:/D:/repository/org/springframework/security/spring-security-crypto/5.2.2.RELEASE/spring-security-crypto-5.2.2.RELEASE.jar, file:/D:/repository/cn/hutool/hutool-all/5.3.5/hutool-all-5.3.5.jar, file:/D:/repository/de/codecentric/spring-boot-admin-starter-client/2.2.3/spring-boot-admin-starter-client-2.2.3.jar, file:/D:/repository/de/codecentric/spring-boot-admin-client/2.2.3/spring-boot-admin-client-2.2.3.jar, file:/F:/soft/idea/idea/lib/idea_rt.jar, file:/F:/soft/idea/idea/plugins/java/lib/rt/debugger-agent.jar]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.5.RELEASE)

17:22:13 [main] DEBUG c.c.f.a.s.b.ApolloApplicationContextInitializer - Apollo bootstrap config is not enabled for context org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3e6534e7, started on Thu Jan 01 08:00:00 CST 1970, parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@62f87c44, see property: ${apollo.bootstrap.enabled}
17:22:13 [main] INFO  com.nisbos.goods.GoodsApplication - No active profile set, falling back to default profiles: default

。。。省略後續日誌

這個日誌如果不細看還以為是啟動報錯,其實這段日誌是springboot2的自動裝配日誌報告。平時我們是不大需要,因此我們可以關閉。關閉的方法也很簡單,從控制檯列印的日誌資訊我們可以得知自動裝配日誌報告是由

org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener

這個類觸發,而且日誌級別是Debug級別。因此要關閉這段日誌,只需在application.yml做如下配置

logging:
  level:
    org:
      springframework:
        boot:
          autoconfigure:
            logging: info

日誌級別改為debug級別以上就行了。然後啟動見證一下奇蹟,奇蹟沒出現,自動裝配日誌報告依然堅挺的出現,並帶著嘲笑的嘴臉,看你裝逼。

排查

以多年的程式設計直覺,我這麼寫應該是沒錯的,錯的原因可能就是把正確的內容放到不恰當的位置,導致不起作用。帶著這個主觀臆斷的思路,我們可以思考下,正常我們控制檯列印日誌資訊的日誌級別會配置在哪裡,一個是配置檔案比如application.yml,一個是配置在日誌檔案中(比如logback檔案中),當然也可以藉助其他工具進行配置(這個我們就不討論了,因為我不會)

驗證

既然我們在application.yml配置不起效果,那我們就在專案中已經配置的logback-spring.xml中加如下內容

 <logger level="info" name="org.springframework.boot.autoconfigure.logging"  additivity="false">
        <appender-ref ref="console"/>
        <appender-ref ref="logFile" />
    </logger>

然後再啟動試下,這次看下控制檯

7:26:09 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Autowiring by type from bean name 'configurationPropertiesRebinder' via factory method to bean named 'configurationPropertiesBeans'
17:26:09 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration'
17:26:09 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.cloud.util.random.CachedRandomPropertySourceAutoConfiguration'
17:26:18 [main] DEBUG o.s.b.c.l.ClasspathLoggingApplicationListener - Application started with classpath: [file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/charsets.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/deploy.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/access-bridge-64.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/cldrdata.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/dnsns.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/jaccess.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/jfxrt.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/localedata.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/nashorn.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunec.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunjce_provider.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunmscapi.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunpkcs11.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/zipfs.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/javaws.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jce.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jfr.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jfxswt.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jsse.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/management-agent.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/plugin.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/resources.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/rt.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-biz/target/classes/, file:/D:/repository/org/springframework/boot/spring-boot-starter/2.2.5.RELEASE/spring-boot-starter-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot/2.2.5.RELEASE/spring-boot-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-logging/2.2.5.RELEASE/spring-boot-starter-logging-2.2.5.RELEASE.jar, file:/D:/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/D:/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/D:/repository/org/apache/logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar, file:/D:/repository/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar, file:/D:/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar, file:/D:/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar, file:/D:/repository/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar, file:/D:/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar, file:/D:/repository/org/springframework/spring-core/5.2.4.RELEASE/spring-core-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-jcl/5.2.4.RELEASE/spring-jcl-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-web/2.2.5.RELEASE/spring-boot-starter-web-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-json/2.2.5.RELEASE/spring-boot-starter-json-2.2.5.RELEASE.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-databind/2.10.2/jackson-databind-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.2/jackson-datatype-jdk8-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.2/jackson-datatype-jsr310-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.2/jackson-module-parameter-names-2.10.2.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-tomcat/2.2.5.RELEASE/spring-boot-starter-tomcat-2.2.5.RELEASE.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.31/tomcat-embed-core-9.0.31.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.31/tomcat-embed-el-9.0.31.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.31/tomcat-embed-websocket-9.0.31.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-validation/2.2.5.RELEASE/spring-boot-starter-validation-2.2.5.RELEASE.jar, file:/D:/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar, file:/D:/repository/org/hibernate/validator/hibernate-validator/6.0.18.Final/hibernate-validator-6.0.18.Final.jar, file:/D:/repository/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar, file:/D:/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar, file:/D:/repository/org/springframework/spring-web/5.2.4.RELEASE/spring-web-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-beans/5.2.4.RELEASE/spring-beans-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-webmvc/5.2.4.RELEASE/spring-webmvc-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-aop/5.2.4.RELEASE/spring-aop-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-context/5.2.4.RELEASE/spring-context-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-expression/5.2.4.RELEASE/spring-expression-5.2.4.RELEASE.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-api/target/classes/, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-openfeign/2.2.2.RELEASE/spring-cloud-starter-openfeign-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-openfeign-core/2.2.2.RELEASE/spring-cloud-openfeign-core-2.2.2.RELEASE.jar, file:/D:/repository/io/github/openfeign/form/feign-form-spring/3.8.0/feign-form-spring-3.8.0.jar, file:/D:/repository/io/github/openfeign/form/feign-form/3.8.0/feign-form-3.8.0.jar, file:/D:/repository/commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar, file:/D:/repository/commons-io/commons-io/2.6/commons-io-2.6.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-commons/2.2.2.RELEASE/spring-cloud-commons-2.2.2.RELEASE.jar, file:/D:/repository/io/github/openfeign/feign-core/10.7.4/feign-core-10.7.4.jar, file:/D:/repository/io/github/openfeign/feign-slf4j/10.7.4/feign-slf4j-10.7.4.jar, file:/D:/repository/io/github/openfeign/feign-hystrix/10.7.4/feign-hystrix-10.7.4.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-common/nisbos-rpc-framework/target/classes/, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-common/nisbos-common-trace/target/classes/, file:/D:/repository/org/springframework/boot/spring-boot-configuration-processor/2.2.5.RELEASE/spring-boot-configuration-processor-2.2.5.RELEASE.jar, file:/D:/repository/com/dianping/cat/cat-client/3.0.0/cat-client-3.0.0.jar, file:/D:/repository/com/ctrip/framework/apollo/apollo-client/1.6.0/apollo-client-1.6.0.jar, file:/D:/repository/com/ctrip/framework/apollo/apollo-core/1.6.0/apollo-core-1.6.0.jar, file:/D:/repository/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar, file:/D:/repository/org/mybatis/mybatis/3.5.3/mybatis-3.5.3.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-common/target/classes/, file:/D:/repository/org/apache/shiro/shiro-core/1.5.3/shiro-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-lang/1.5.3/shiro-lang-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-cache/1.5.3/shiro-cache-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-hash/1.5.3/shiro-crypto-hash-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-core/1.5.3/shiro-crypto-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-cipher/1.5.3/shiro-crypto-cipher-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-config-core/1.5.3/shiro-config-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-config-ogdl/1.5.3/shiro-config-ogdl-1.5.3.jar, file:/D:/repository/commons-beanutils/commons-beanutils/1.9.4/commons-beanutils-1.9.4.jar, file:/D:/repository/org/apache/shiro/shiro-event/1.5.3/shiro-event-1.5.3.jar, file:/D:/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/D:/repository/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar, file:/D:/repository/com/baomidou/mybatis-plus-boot-starter/3.3.1/mybatis-plus-boot-starter-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus/3.3.1/mybatis-plus-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-extension/3.3.1/mybatis-plus-extension-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-core/3.3.1/mybatis-plus-core-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-annotation/3.3.1/mybatis-plus-annotation-3.3.1.jar, file:/D:/repository/com/github/jsqlparser/jsqlparser/3.1/jsqlparser-3.1.jar, file:/D:/repository/org/mybatis/mybatis-spring/2.0.3/mybatis-spring-2.0.3.jar, file:/D:/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.5.RELEASE/spring-boot-autoconfigure-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-jdbc/2.2.5.RELEASE/spring-boot-starter-jdbc-2.2.5.RELEASE.jar, file:/D:/repository/com/zaxxer/HikariCP/3.4.2/HikariCP-3.4.2.jar, file:/D:/repository/org/springframework/spring-jdbc/5.2.4.RELEASE/spring-jdbc-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-tx/5.2.4.RELEASE/spring-tx-5.2.4.RELEASE.jar, file:/D:/repository/mysql/mysql-connector-java/8.0.19/mysql-connector-java-8.0.19.jar, file:/D:/repository/com/alibaba/druid/1.0.28/druid-1.0.28.jar, file:/F:/soft/jdk/jdk1.8.0_241/lib/jconsole.jar, file:/F:/soft/jdk/jdk1.8.0_241/lib/tools.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-eureka-client/2.2.2.RELEASE/spring-cloud-starter-netflix-eureka-client-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter/2.2.2.RELEASE/spring-cloud-starter-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/security/spring-security-rsa/1.0.9.RELEASE/spring-security-rsa-1.0.9.RELEASE.jar, file:/D:/repository/org/bouncycastle/bcpkix-jdk15on/1.64/bcpkix-jdk15on-1.64.jar, file:/D:/repository/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-hystrix/2.2.2.RELEASE/spring-cloud-netflix-hystrix-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-aop/2.2.5.RELEASE/spring-boot-starter-aop-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-eureka-client/2.2.2.RELEASE/spring-cloud-netflix-eureka-client-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/eureka/eureka-client/1.9.17/eureka-client-1.9.17.jar, file:/D:/repository/org/codehaus/jettison/jettison/1.3.7/jettison-1.3.7.jar, file:/D:/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-eventbus/0.3.0/netflix-eventbus-0.3.0.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-infix/0.3.0/netflix-infix-0.3.0.jar, file:/D:/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar, file:/D:/repository/joda-time/joda-time/2.10.5/joda-time-2.10.5.jar, file:/D:/repository/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar, file:/D:/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar, file:/D:/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/D:/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar, file:/D:/repository/com/netflix/archaius/archaius-core/0.7.6/archaius-core-0.7.6.jar, file:/D:/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar, file:/D:/repository/com/netflix/servo/servo-core/0.12.21/servo-core-0.12.21.jar, file:/D:/repository/com/sun/jersey/jersey-core/1.19.1/jersey-core-1.19.1.jar, file:/D:/repository/com/sun/jersey/jersey-client/1.19.1/jersey-client-1.19.1.jar, file:/D:/repository/com/sun/jersey/contribs/jersey-apache-client4/1.19.1/jersey-apache-client4-1.19.1.jar, file:/D:/repository/org/apache/httpcomponents/httpclient/4.5.12/httpclient-4.5.12.jar, file:/D:/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar, file:/D:/repository/commons-codec/commons-codec/1.14/commons-codec-1.14.jar, file:/D:/repository/com/google/inject/guice/4.1.0/guice-4.1.0.jar, file:/D:/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/D:/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotations-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2.jar, file:/D:/repository/com/netflix/eureka/eureka-core/1.9.17/eureka-core-1.9.17.jar, file:/D:/repository/com/fasterxml/woodstox/woodstox-core/5.0.3/woodstox-core-5.0.3.jar, file:/D:/repository/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-archaius/2.2.2.RELEASE/spring-cloud-starter-netflix-archaius-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-archaius/2.2.2.RELEASE/spring-cloud-netflix-archaius-2.2.2.RELEASE.jar, file:/D:/repository/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-ribbon/2.2.2.RELEASE/spring-cloud-starter-netflix-ribbon-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/ribbon/ribbon/2.3.0/ribbon-2.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-transport/2.3.0/ribbon-transport-2.3.0.jar, file:/D:/repository/io/reactivex/rxnetty-contexts/0.4.9/rxnetty-contexts-0.4.9.jar, file:/D:/repository/io/reactivex/rxnetty-servo/0.4.9/rxnetty-servo-0.4.9.jar, file:/D:/repository/io/reactivex/rxnetty/0.4.9/rxnetty-0.4.9.jar, file:/D:/repository/com/netflix/ribbon/ribbon-core/2.3.0/ribbon-core-2.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-httpclient/2.3.0/ribbon-httpclient-2.3.0.jar, file:/D:/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-commons-util/0.3.0/netflix-commons-util-0.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-loadbalancer/2.3.0/ribbon-loadbalancer-2.3.0.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar, file:/D:/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-loadbalancer/2.2.2.RELEASE/spring-cloud-starter-loadbalancer-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-loadbalancer/2.2.2.RELEASE/spring-cloud-loadbalancer-2.2.2.RELEASE.jar, file:/D:/repository/io/projectreactor/reactor-core/3.3.3.RELEASE/reactor-core-3.3.3.RELEASE.jar, file:/D:/repository/io/projectreactor/addons/reactor-extra/3.3.2.RELEASE/reactor-extra-3.3.2.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-cache/2.2.5.RELEASE/spring-boot-starter-cache-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/spring-context-support/5.2.4.RELEASE/spring-context-support-5.2.4.RELEASE.jar, file:/D:/repository/com/stoyanr/evictor/1.0.0/evictor-1.0.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-eureka/2.3.0/ribbon-eureka-2.3.0.jar, file:/D:/repository/com/thoughtworks/xstream/xstream/1.4.12/xstream-1.4.12.jar, file:/D:/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/D:/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-hystrix/2.2.2.RELEASE/spring-cloud-starter-netflix-hystrix-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-ribbon/2.2.2.RELEASE/spring-cloud-netflix-ribbon-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/hystrix/hystrix-core/1.5.18/hystrix-core-1.5.18.jar, file:/D:/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar, file:/D:/repository/com/netflix/hystrix/hystrix-serialization/1.5.18/hystrix-serialization-1.5.18.jar, file:/D:/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.10.2/jackson-module-afterburner-2.10.2.jar, file:/D:/repository/com/netflix/hystrix/hystrix-metrics-event-stream/1.5.18/hystrix-metrics-event-stream-1.5.18.jar, file:/D:/repository/com/netflix/hystrix/hystrix-javanica/1.5.18/hystrix-javanica-1.5.18.jar, file:/D:/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar, file:/D:/repository/org/aspectj/aspectjweaver/1.9.5/aspectjweaver-1.9.5.jar, file:/D:/repository/com/google/guava/guava/28.2-android/guava-28.2-android.jar, file:/D:/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar, file:/D:/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar, file:/D:/repository/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar, file:/D:/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar, file:/D:/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar, file:/D:/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar, file:/D:/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-actuator/2.2.5.RELEASE/spring-boot-starter-actuator-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.2.5.RELEASE/spring-boot-actuator-autoconfigure-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-actuator/2.2.5.RELEASE/spring-boot-actuator-2.2.5.RELEASE.jar, file:/D:/repository/io/micrometer/micrometer-core/1.3.5/micrometer-core-1.3.5.jar, file:/D:/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar, file:/D:/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-context/2.2.3.RELEASE/spring-cloud-context-2.2.3.RELEASE.jar, file:/D:/repository/org/springframework/security/spring-security-crypto/5.2.2.RELEASE/spring-security-crypto-5.2.2.RELEASE.jar, file:/D:/repository/cn/hutool/hutool-all/5.3.5/hutool-all-5.3.5.jar, file:/D:/repository/de/codecentric/spring-boot-admin-starter-client/2.2.3/spring-boot-admin-starter-client-2.2.3.jar, file:/D:/repository/de/codecentric/spring-boot-admin-client/2.2.3/spring-boot-admin-client-2.2.3.jar, file:/F:/soft/idea/idea/lib/idea_rt.jar, file:/F:/soft/idea/idea/plugins/java/lib/rt/debugger-agent.jar]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.5.RELEASE)

17:26:18 [main] DEBUG c.c.f.a.s.b.ApolloApplicationContextInitializer - Apollo bootstrap config is not enabled for context
。。。省略後續日誌

很明顯這次我們成功了

Q&A

1、當專案中只有application.yml檔案時,配置的日誌級別是否生效?

會生效

驗證

去除專案中的logback-spring.xml,然後在application.yml配置如下內容

logging:
  level:
    org:
      springframework:
        boot:
          autoconfigure:
            logging: info

啟動檢視日誌資訊

Connected to the target VM, address: '127.0.0.1:59757', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.5.RELEASE)

2020-07-14 19:08:53.345  INFO 5868 --- [           main] com.nisbos.goods.GoodsApplication        : No active profile set, falling back to default profiles: default
2020-07-14 19:08:54.853  WARN 5868 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2020-07-14 19:08:54.874  WARN 5868 --- [           main] o.s.boot.actuate.endpoint.EndpointId 

說明配置生效

2、當專案中同時存在logback-spring.xml和application.yml,同種類包日誌級別配置以哪個為準?

以logback-spring.xml配置的日誌級別為準

驗證一
logback-spring.xml配置日誌級別為debug

 <logger level="debug" name="org.springframework.boot.autoconfigure.logging"  additivity="false">
        <appender-ref ref="console"/>
        <appender-ref ref="logFile" />
    </logger>

application.yml配置日誌級別為info

logging:
  org:
    springframework:
      boot:
        autoconfigure:
          logging: info

啟動檢視控制檯

11:00:41 [main] DEBUG o.s.b.a.l.ConditionEvaluationReportLoggingListener - 


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


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

   ConfigurationPropertiesRebinderAutoConfiguration matched:
      - @ConditionalOnBean (types: org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor; SearchStrategy: all) found bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesBeans matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesBeans; SearchStrategy: current) did not find any beans (OnBeanCondition)

   ConfigurationPropertiesRebinderAutoConfiguration#configurationPropertiesRebinder matched:
      - @ConditionalOnMissingBean (types: org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder; SearchStrategy: current) did not find any beans (OnBeanCondition)

   EncryptionBootstrapConfiguration matched:
      - @ConditionalOnClass found required class 'org.springframework.security.crypto.encrypt.TextEncryptor' (OnClassCondition)

   PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer matched:
      - @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) did not find any beans (OnBeanCondition)


Negative matches:
-----------------

   EncryptionBootstrapConfiguration.RsaEncryptionConfiguration:
      Did not match:
         - Keystore nor key found in Environment (EncryptionBootstrapConfiguration.KeyCondition)
      Matched:
         - @ConditionalOnClass found required class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)

   EncryptionBootstrapConfiguration.VanillaEncryptionConfiguration:
      Did not match:
         - @ConditionalOnMissingClass found unwanted class 'org.springframework.security.rsa.crypto.RsaSecretEncryptor' (OnClassCondition)

   EurekaDiscoveryClientConfigServiceBootstrapConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.cloud.config.client.ConfigServicePropertySourceLocator' (OnClassCondition)


Exclusions:
-----------

    None


Unconditional classes:
----------------------

    None



11:00:50 [main] DEBUG o.s.b.c.l.ClasspathLoggingApplicationListener - Application started with classpath: [file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/charsets.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/deploy.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/access-bridge-64.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/cldrdata.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/dnsns.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/jaccess.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/jfxrt.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/localedata.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/nashorn.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunec.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunjce_provider.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunmscapi.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunpkcs11.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/zipfs.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/javaws.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jce.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jfr.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jfxswt.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jsse.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/management-agent.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/plugin.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/resources.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/rt.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-biz/target/classes/, file:/D:/repository/org/springframework/boot/spring-boot-starter/2.2.5.RELEASE/spring-boot-starter-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot/2.2.5.RELEASE/spring-boot-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-logging/2.2.5.RELEASE/spring-boot-starter-logging-2.2.5.RELEASE.jar, file:/D:/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/D:/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/D:/repository/org/apache/logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar, file:/D:/repository/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar, file:/D:/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar, file:/D:/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar, file:/D:/repository/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar, file:/D:/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar, file:/D:/repository/org/springframework/spring-core/5.2.4.RELEASE/spring-core-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-jcl/5.2.4.RELEASE/spring-jcl-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-web/2.2.5.RELEASE/spring-boot-starter-web-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-json/2.2.5.RELEASE/spring-boot-starter-json-2.2.5.RELEASE.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-databind/2.10.2/jackson-databind-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.2/jackson-datatype-jdk8-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.2/jackson-datatype-jsr310-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.2/jackson-module-parameter-names-2.10.2.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-tomcat/2.2.5.RELEASE/spring-boot-starter-tomcat-2.2.5.RELEASE.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.31/tomcat-embed-core-9.0.31.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.31/tomcat-embed-el-9.0.31.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.31/tomcat-embed-websocket-9.0.31.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-validation/2.2.5.RELEASE/spring-boot-starter-validation-2.2.5.RELEASE.jar, file:/D:/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar, file:/D:/repository/org/hibernate/validator/hibernate-validator/6.0.18.Final/hibernate-validator-6.0.18.Final.jar, file:/D:/repository/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar, file:/D:/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar, file:/D:/repository/org/springframework/spring-web/5.2.4.RELEASE/spring-web-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-beans/5.2.4.RELEASE/spring-beans-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-webmvc/5.2.4.RELEASE/spring-webmvc-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-aop/5.2.4.RELEASE/spring-aop-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-context/5.2.4.RELEASE/spring-context-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-expression/5.2.4.RELEASE/spring-expression-5.2.4.RELEASE.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-api/target/classes/, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-openfeign/2.2.2.RELEASE/spring-cloud-starter-openfeign-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-openfeign-core/2.2.2.RELEASE/spring-cloud-openfeign-core-2.2.2.RELEASE.jar, file:/D:/repository/io/github/openfeign/form/feign-form-spring/3.8.0/feign-form-spring-3.8.0.jar, file:/D:/repository/io/github/openfeign/form/feign-form/3.8.0/feign-form-3.8.0.jar, file:/D:/repository/commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar, file:/D:/repository/commons-io/commons-io/2.6/commons-io-2.6.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-commons/2.2.2.RELEASE/spring-cloud-commons-2.2.2.RELEASE.jar, file:/D:/repository/io/github/openfeign/feign-core/10.7.4/feign-core-10.7.4.jar, file:/D:/repository/io/github/openfeign/feign-slf4j/10.7.4/feign-slf4j-10.7.4.jar, file:/D:/repository/io/github/openfeign/feign-hystrix/10.7.4/feign-hystrix-10.7.4.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-common/nisbos-rpc-framework/target/classes/, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-common/nisbos-common-trace/target/classes/, file:/D:/repository/org/springframework/boot/spring-boot-configuration-processor/2.2.5.RELEASE/spring-boot-configuration-processor-2.2.5.RELEASE.jar, file:/D:/repository/com/dianping/cat/cat-client/3.0.0/cat-client-3.0.0.jar, file:/D:/repository/com/ctrip/framework/apollo/apollo-client/1.6.0/apollo-client-1.6.0.jar, file:/D:/repository/com/ctrip/framework/apollo/apollo-core/1.6.0/apollo-core-1.6.0.jar, file:/D:/repository/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar, file:/D:/repository/org/mybatis/mybatis/3.5.3/mybatis-3.5.3.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-common/target/classes/, file:/D:/repository/org/apache/shiro/shiro-core/1.5.3/shiro-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-lang/1.5.3/shiro-lang-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-cache/1.5.3/shiro-cache-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-hash/1.5.3/shiro-crypto-hash-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-core/1.5.3/shiro-crypto-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-cipher/1.5.3/shiro-crypto-cipher-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-config-core/1.5.3/shiro-config-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-config-ogdl/1.5.3/shiro-config-ogdl-1.5.3.jar, file:/D:/repository/commons-beanutils/commons-beanutils/1.9.4/commons-beanutils-1.9.4.jar, file:/D:/repository/org/apache/shiro/shiro-event/1.5.3/shiro-event-1.5.3.jar, file:/D:/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/D:/repository/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar, file:/D:/repository/com/baomidou/mybatis-plus-boot-starter/3.3.1/mybatis-plus-boot-starter-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus/3.3.1/mybatis-plus-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-extension/3.3.1/mybatis-plus-extension-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-core/3.3.1/mybatis-plus-core-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-annotation/3.3.1/mybatis-plus-annotation-3.3.1.jar, file:/D:/repository/com/github/jsqlparser/jsqlparser/3.1/jsqlparser-3.1.jar, file:/D:/repository/org/mybatis/mybatis-spring/2.0.3/mybatis-spring-2.0.3.jar, file:/D:/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.5.RELEASE/spring-boot-autoconfigure-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-jdbc/2.2.5.RELEASE/spring-boot-starter-jdbc-2.2.5.RELEASE.jar, file:/D:/repository/com/zaxxer/HikariCP/3.4.2/HikariCP-3.4.2.jar, file:/D:/repository/org/springframework/spring-jdbc/5.2.4.RELEASE/spring-jdbc-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-tx/5.2.4.RELEASE/spring-tx-5.2.4.RELEASE.jar, file:/D:/repository/mysql/mysql-connector-java/8.0.19/mysql-connector-java-8.0.19.jar, file:/D:/repository/com/alibaba/druid/1.0.28/druid-1.0.28.jar, file:/F:/soft/jdk/jdk1.8.0_241/lib/jconsole.jar, file:/F:/soft/jdk/jdk1.8.0_241/lib/tools.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-eureka-client/2.2.2.RELEASE/spring-cloud-starter-netflix-eureka-client-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter/2.2.2.RELEASE/spring-cloud-starter-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/security/spring-security-rsa/1.0.9.RELEASE/spring-security-rsa-1.0.9.RELEASE.jar, file:/D:/repository/org/bouncycastle/bcpkix-jdk15on/1.64/bcpkix-jdk15on-1.64.jar, file:/D:/repository/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-hystrix/2.2.2.RELEASE/spring-cloud-netflix-hystrix-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-aop/2.2.5.RELEASE/spring-boot-starter-aop-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-eureka-client/2.2.2.RELEASE/spring-cloud-netflix-eureka-client-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/eureka/eureka-client/1.9.17/eureka-client-1.9.17.jar, file:/D:/repository/org/codehaus/jettison/jettison/1.3.7/jettison-1.3.7.jar, file:/D:/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-eventbus/0.3.0/netflix-eventbus-0.3.0.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-infix/0.3.0/netflix-infix-0.3.0.jar, file:/D:/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar, file:/D:/repository/joda-time/joda-time/2.10.5/joda-time-2.10.5.jar, file:/D:/repository/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar, file:/D:/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar, file:/D:/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/D:/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar, file:/D:/repository/com/netflix/archaius/archaius-core/0.7.6/archaius-core-0.7.6.jar, file:/D:/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar, file:/D:/repository/com/netflix/servo/servo-core/0.12.21/servo-core-0.12.21.jar, file:/D:/repository/com/sun/jersey/jersey-core/1.19.1/jersey-core-1.19.1.jar, file:/D:/repository/com/sun/jersey/jersey-client/1.19.1/jersey-client-1.19.1.jar, file:/D:/repository/com/sun/jersey/contribs/jersey-apache-client4/1.19.1/jersey-apache-client4-1.19.1.jar, file:/D:/repository/org/apache/httpcomponents/httpclient/4.5.12/httpclient-4.5.12.jar, file:/D:/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar, file:/D:/repository/commons-codec/commons-codec/1.14/commons-codec-1.14.jar, file:/D:/repository/com/google/inject/guice/4.1.0/guice-4.1.0.jar, file:/D:/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/D:/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotations-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2.jar, file:/D:/repository/com/netflix/eureka/eureka-core/1.9.17/eureka-core-1.9.17.jar, file:/D:/repository/com/fasterxml/woodstox/woodstox-core/5.0.3/woodstox-core-5.0.3.jar, file:/D:/repository/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-archaius/2.2.2.RELEASE/spring-cloud-starter-netflix-archaius-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-archaius/2.2.2.RELEASE/spring-cloud-netflix-archaius-2.2.2.RELEASE.jar, file:/D:/repository/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-ribbon/2.2.2.RELEASE/spring-cloud-starter-netflix-ribbon-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/ribbon/ribbon/2.3.0/ribbon-2.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-transport/2.3.0/ribbon-transport-2.3.0.jar, file:/D:/repository/io/reactivex/rxnetty-contexts/0.4.9/rxnetty-contexts-0.4.9.jar, file:/D:/repository/io/reactivex/rxnetty-servo/0.4.9/rxnetty-servo-0.4.9.jar, file:/D:/repository/io/reactivex/rxnetty/0.4.9/rxnetty-0.4.9.jar, file:/D:/repository/com/netflix/ribbon/ribbon-core/2.3.0/ribbon-core-2.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-httpclient/2.3.0/ribbon-httpclient-2.3.0.jar, file:/D:/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-commons-util/0.3.0/netflix-commons-util-0.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-loadbalancer/2.3.0/ribbon-loadbalancer-2.3.0.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar, file:/D:/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-loadbalancer/2.2.2.RELEASE/spring-cloud-starter-loadbalancer-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-loadbalancer/2.2.2.RELEASE/spring-cloud-loadbalancer-2.2.2.RELEASE.jar, file:/D:/repository/io/projectreactor/reactor-core/3.3.3.RELEASE/reactor-core-3.3.3.RELEASE.jar, file:/D:/repository/io/projectreactor/addons/reactor-extra/3.3.2.RELEASE/reactor-extra-3.3.2.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-cache/2.2.5.RELEASE/spring-boot-starter-cache-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/spring-context-support/5.2.4.RELEASE/spring-context-support-5.2.4.RELEASE.jar, file:/D:/repository/com/stoyanr/evictor/1.0.0/evictor-1.0.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-eureka/2.3.0/ribbon-eureka-2.3.0.jar, file:/D:/repository/com/thoughtworks/xstream/xstream/1.4.12/xstream-1.4.12.jar, file:/D:/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/D:/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-hystrix/2.2.2.RELEASE/spring-cloud-starter-netflix-hystrix-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-ribbon/2.2.2.RELEASE/spring-cloud-netflix-ribbon-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/hystrix/hystrix-core/1.5.18/hystrix-core-1.5.18.jar, file:/D:/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar, file:/D:/repository/com/netflix/hystrix/hystrix-serialization/1.5.18/hystrix-serialization-1.5.18.jar, file:/D:/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.10.2/jackson-module-afterburner-2.10.2.jar, file:/D:/repository/com/netflix/hystrix/hystrix-metrics-event-stream/1.5.18/hystrix-metrics-event-stream-1.5.18.jar, file:/D:/repository/com/netflix/hystrix/hystrix-javanica/1.5.18/hystrix-javanica-1.5.18.jar, file:/D:/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar, file:/D:/repository/org/aspectj/aspectjweaver/1.9.5/aspectjweaver-1.9.5.jar, file:/D:/repository/com/google/guava/guava/28.2-android/guava-28.2-android.jar, file:/D:/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar, file:/D:/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar, file:/D:/repository/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar, file:/D:/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar, file:/D:/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar, file:/D:/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar, file:/D:/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-actuator/2.2.5.RELEASE/spring-boot-starter-actuator-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.2.5.RELEASE/spring-boot-actuator-autoconfigure-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-actuator/2.2.5.RELEASE/spring-boot-actuator-2.2.5.RELEASE.jar, file:/D:/repository/io/micrometer/micrometer-core/1.3.5/micrometer-core-1.3.5.jar, file:/D:/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar, file:/D:/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-context/2.2.3.RELEASE/spring-cloud-context-2.2.3.RELEASE.jar, file:/D:/repository/org/springframework/security/spring-security-crypto/5.2.2.RELEASE/spring-security-crypto-5.2.2.RELEASE.jar, file:/D:/repository/cn/hutool/hutool-all/5.3.5/hutool-all-5.3.5.jar, file:/D:/repository/de/codecentric/spring-boot-admin-starter-client/2.2.3/spring-boot-admin-starter-client-2.2.3.jar, file:/D:/repository/de/codecentric/spring-boot-admin-client/2.2.3/spring-boot-admin-client-2.2.3.jar, file:/F:/soft/idea/idea/lib/idea_rt.jar, file:/F:/soft/idea/idea/plugins/java/lib/rt/debugger-agent.jar]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.5.RELEASE)

11:00:50 [main] DEBUG c.c.f.a.s.b.ApolloApplicationContextInitializer - Apollo bootstrap config is not enabled for context org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@4f966719, started on Thu Jan 01 08:00:00 CST 1970, parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@f5c79a6, see property: ${apollo.bootstrap.enabled}
11:00:50 [main] INFO  com.nisbos.goods.GoodsApplication - No active profile set, falling back to default profiles: default

驗證二

logback-spring.xml配置日誌級別為info

 <logger level="info" name="org.springframework.boot.autoconfigure.logging"  additivity="false">
        <appender-ref ref="console"/>
        <appender-ref ref="logFile" />
    </logger>

application.yml配置日誌級別為debug

logging:
  org:
    springframework:
      boot:
        autoconfigure:
          logging: debug

啟動檢視控制檯

11:26:41 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.cloud.util.random.CachedRandomPropertySourceAutoConfiguration'
11:26:51 [main] DEBUG o.s.b.c.l.ClasspathLoggingApplicationListener - Application started with classpath: [file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/charsets.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/deploy.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/access-bridge-64.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/cldrdata.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/dnsns.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/jaccess.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/jfxrt.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/localedata.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/nashorn.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunec.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunjce_provider.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunmscapi.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/sunpkcs11.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/ext/zipfs.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/javaws.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jce.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jfr.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jfxswt.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/jsse.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/management-agent.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/plugin.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/resources.jar, file:/F:/soft/jdk/jdk1.8.0_241/jre/lib/rt.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-biz/target/classes/, file:/D:/repository/org/springframework/boot/spring-boot-starter/2.2.5.RELEASE/spring-boot-starter-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot/2.2.5.RELEASE/spring-boot-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-logging/2.2.5.RELEASE/spring-boot-starter-logging-2.2.5.RELEASE.jar, file:/D:/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/D:/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/D:/repository/org/apache/logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar, file:/D:/repository/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar, file:/D:/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar, file:/D:/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar, file:/D:/repository/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar, file:/D:/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar, file:/D:/repository/org/springframework/spring-core/5.2.4.RELEASE/spring-core-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-jcl/5.2.4.RELEASE/spring-jcl-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-web/2.2.5.RELEASE/spring-boot-starter-web-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-json/2.2.5.RELEASE/spring-boot-starter-json-2.2.5.RELEASE.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-databind/2.10.2/jackson-databind-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.2/jackson-datatype-jdk8-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.2/jackson-datatype-jsr310-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.2/jackson-module-parameter-names-2.10.2.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-tomcat/2.2.5.RELEASE/spring-boot-starter-tomcat-2.2.5.RELEASE.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.31/tomcat-embed-core-9.0.31.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.31/tomcat-embed-el-9.0.31.jar, file:/D:/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.31/tomcat-embed-websocket-9.0.31.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-validation/2.2.5.RELEASE/spring-boot-starter-validation-2.2.5.RELEASE.jar, file:/D:/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar, file:/D:/repository/org/hibernate/validator/hibernate-validator/6.0.18.Final/hibernate-validator-6.0.18.Final.jar, file:/D:/repository/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar, file:/D:/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar, file:/D:/repository/org/springframework/spring-web/5.2.4.RELEASE/spring-web-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-beans/5.2.4.RELEASE/spring-beans-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-webmvc/5.2.4.RELEASE/spring-webmvc-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-aop/5.2.4.RELEASE/spring-aop-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-context/5.2.4.RELEASE/spring-context-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-expression/5.2.4.RELEASE/spring-expression-5.2.4.RELEASE.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-api/target/classes/, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-openfeign/2.2.2.RELEASE/spring-cloud-starter-openfeign-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-openfeign-core/2.2.2.RELEASE/spring-cloud-openfeign-core-2.2.2.RELEASE.jar, file:/D:/repository/io/github/openfeign/form/feign-form-spring/3.8.0/feign-form-spring-3.8.0.jar, file:/D:/repository/io/github/openfeign/form/feign-form/3.8.0/feign-form-3.8.0.jar, file:/D:/repository/commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar, file:/D:/repository/commons-io/commons-io/2.6/commons-io-2.6.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-commons/2.2.2.RELEASE/spring-cloud-commons-2.2.2.RELEASE.jar, file:/D:/repository/io/github/openfeign/feign-core/10.7.4/feign-core-10.7.4.jar, file:/D:/repository/io/github/openfeign/feign-slf4j/10.7.4/feign-slf4j-10.7.4.jar, file:/D:/repository/io/github/openfeign/feign-hystrix/10.7.4/feign-hystrix-10.7.4.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-common/nisbos-rpc-framework/target/classes/, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-common/nisbos-common-trace/target/classes/, file:/D:/repository/org/springframework/boot/spring-boot-configuration-processor/2.2.5.RELEASE/spring-boot-configuration-processor-2.2.5.RELEASE.jar, file:/D:/repository/com/dianping/cat/cat-client/3.0.0/cat-client-3.0.0.jar, file:/D:/repository/com/ctrip/framework/apollo/apollo-client/1.6.0/apollo-client-1.6.0.jar, file:/D:/repository/com/ctrip/framework/apollo/apollo-core/1.6.0/apollo-core-1.6.0.jar, file:/D:/repository/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar, file:/D:/repository/org/mybatis/mybatis/3.5.3/mybatis-3.5.3.jar, file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-common/target/classes/, file:/D:/repository/org/apache/shiro/shiro-core/1.5.3/shiro-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-lang/1.5.3/shiro-lang-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-cache/1.5.3/shiro-cache-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-hash/1.5.3/shiro-crypto-hash-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-core/1.5.3/shiro-crypto-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-crypto-cipher/1.5.3/shiro-crypto-cipher-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-config-core/1.5.3/shiro-config-core-1.5.3.jar, file:/D:/repository/org/apache/shiro/shiro-config-ogdl/1.5.3/shiro-config-ogdl-1.5.3.jar, file:/D:/repository/commons-beanutils/commons-beanutils/1.9.4/commons-beanutils-1.9.4.jar, file:/D:/repository/org/apache/shiro/shiro-event/1.5.3/shiro-event-1.5.3.jar, file:/D:/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/D:/repository/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar, file:/D:/repository/com/baomidou/mybatis-plus-boot-starter/3.3.1/mybatis-plus-boot-starter-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus/3.3.1/mybatis-plus-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-extension/3.3.1/mybatis-plus-extension-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-core/3.3.1/mybatis-plus-core-3.3.1.jar, file:/D:/repository/com/baomidou/mybatis-plus-annotation/3.3.1/mybatis-plus-annotation-3.3.1.jar, file:/D:/repository/com/github/jsqlparser/jsqlparser/3.1/jsqlparser-3.1.jar, file:/D:/repository/org/mybatis/mybatis-spring/2.0.3/mybatis-spring-2.0.3.jar, file:/D:/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.5.RELEASE/spring-boot-autoconfigure-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-jdbc/2.2.5.RELEASE/spring-boot-starter-jdbc-2.2.5.RELEASE.jar, file:/D:/repository/com/zaxxer/HikariCP/3.4.2/HikariCP-3.4.2.jar, file:/D:/repository/org/springframework/spring-jdbc/5.2.4.RELEASE/spring-jdbc-5.2.4.RELEASE.jar, file:/D:/repository/org/springframework/spring-tx/5.2.4.RELEASE/spring-tx-5.2.4.RELEASE.jar, file:/D:/repository/mysql/mysql-connector-java/8.0.19/mysql-connector-java-8.0.19.jar, file:/D:/repository/com/alibaba/druid/1.0.28/druid-1.0.28.jar, file:/F:/soft/jdk/jdk1.8.0_241/lib/jconsole.jar, file:/F:/soft/jdk/jdk1.8.0_241/lib/tools.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-eureka-client/2.2.2.RELEASE/spring-cloud-starter-netflix-eureka-client-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter/2.2.2.RELEASE/spring-cloud-starter-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/security/spring-security-rsa/1.0.9.RELEASE/spring-security-rsa-1.0.9.RELEASE.jar, file:/D:/repository/org/bouncycastle/bcpkix-jdk15on/1.64/bcpkix-jdk15on-1.64.jar, file:/D:/repository/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-hystrix/2.2.2.RELEASE/spring-cloud-netflix-hystrix-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-aop/2.2.5.RELEASE/spring-boot-starter-aop-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-eureka-client/2.2.2.RELEASE/spring-cloud-netflix-eureka-client-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/eureka/eureka-client/1.9.17/eureka-client-1.9.17.jar, file:/D:/repository/org/codehaus/jettison/jettison/1.3.7/jettison-1.3.7.jar, file:/D:/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-eventbus/0.3.0/netflix-eventbus-0.3.0.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-infix/0.3.0/netflix-infix-0.3.0.jar, file:/D:/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar, file:/D:/repository/joda-time/joda-time/2.10.5/joda-time-2.10.5.jar, file:/D:/repository/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar, file:/D:/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar, file:/D:/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/D:/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar, file:/D:/repository/com/netflix/archaius/archaius-core/0.7.6/archaius-core-0.7.6.jar, file:/D:/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar, file:/D:/repository/com/netflix/servo/servo-core/0.12.21/servo-core-0.12.21.jar, file:/D:/repository/com/sun/jersey/jersey-core/1.19.1/jersey-core-1.19.1.jar, file:/D:/repository/com/sun/jersey/jersey-client/1.19.1/jersey-client-1.19.1.jar, file:/D:/repository/com/sun/jersey/contribs/jersey-apache-client4/1.19.1/jersey-apache-client4-1.19.1.jar, file:/D:/repository/org/apache/httpcomponents/httpclient/4.5.12/httpclient-4.5.12.jar, file:/D:/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar, file:/D:/repository/commons-codec/commons-codec/1.14/commons-codec-1.14.jar, file:/D:/repository/com/google/inject/guice/4.1.0/guice-4.1.0.jar, file:/D:/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/D:/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotations-2.10.2.jar, file:/D:/repository/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2.jar, file:/D:/repository/com/netflix/eureka/eureka-core/1.9.17/eureka-core-1.9.17.jar, file:/D:/repository/com/fasterxml/woodstox/woodstox-core/5.0.3/woodstox-core-5.0.3.jar, file:/D:/repository/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-archaius/2.2.2.RELEASE/spring-cloud-starter-netflix-archaius-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-archaius/2.2.2.RELEASE/spring-cloud-netflix-archaius-2.2.2.RELEASE.jar, file:/D:/repository/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-ribbon/2.2.2.RELEASE/spring-cloud-starter-netflix-ribbon-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/ribbon/ribbon/2.3.0/ribbon-2.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-transport/2.3.0/ribbon-transport-2.3.0.jar, file:/D:/repository/io/reactivex/rxnetty-contexts/0.4.9/rxnetty-contexts-0.4.9.jar, file:/D:/repository/io/reactivex/rxnetty-servo/0.4.9/rxnetty-servo-0.4.9.jar, file:/D:/repository/io/reactivex/rxnetty/0.4.9/rxnetty-0.4.9.jar, file:/D:/repository/com/netflix/ribbon/ribbon-core/2.3.0/ribbon-core-2.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-httpclient/2.3.0/ribbon-httpclient-2.3.0.jar, file:/D:/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-commons-util/0.3.0/netflix-commons-util-0.3.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-loadbalancer/2.3.0/ribbon-loadbalancer-2.3.0.jar, file:/D:/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar, file:/D:/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-loadbalancer/2.2.2.RELEASE/spring-cloud-starter-loadbalancer-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-loadbalancer/2.2.2.RELEASE/spring-cloud-loadbalancer-2.2.2.RELEASE.jar, file:/D:/repository/io/projectreactor/reactor-core/3.3.3.RELEASE/reactor-core-3.3.3.RELEASE.jar, file:/D:/repository/io/projectreactor/addons/reactor-extra/3.3.2.RELEASE/reactor-extra-3.3.2.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-cache/2.2.5.RELEASE/spring-boot-starter-cache-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/spring-context-support/5.2.4.RELEASE/spring-context-support-5.2.4.RELEASE.jar, file:/D:/repository/com/stoyanr/evictor/1.0.0/evictor-1.0.0.jar, file:/D:/repository/com/netflix/ribbon/ribbon-eureka/2.3.0/ribbon-eureka-2.3.0.jar, file:/D:/repository/com/thoughtworks/xstream/xstream/1.4.12/xstream-1.4.12.jar, file:/D:/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/D:/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-starter-netflix-hystrix/2.2.2.RELEASE/spring-cloud-starter-netflix-hystrix-2.2.2.RELEASE.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-netflix-ribbon/2.2.2.RELEASE/spring-cloud-netflix-ribbon-2.2.2.RELEASE.jar, file:/D:/repository/com/netflix/hystrix/hystrix-core/1.5.18/hystrix-core-1.5.18.jar, file:/D:/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar, file:/D:/repository/com/netflix/hystrix/hystrix-serialization/1.5.18/hystrix-serialization-1.5.18.jar, file:/D:/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.10.2/jackson-module-afterburner-2.10.2.jar, file:/D:/repository/com/netflix/hystrix/hystrix-metrics-event-stream/1.5.18/hystrix-metrics-event-stream-1.5.18.jar, file:/D:/repository/com/netflix/hystrix/hystrix-javanica/1.5.18/hystrix-javanica-1.5.18.jar, file:/D:/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar, file:/D:/repository/org/aspectj/aspectjweaver/1.9.5/aspectjweaver-1.9.5.jar, file:/D:/repository/com/google/guava/guava/28.2-android/guava-28.2-android.jar, file:/D:/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar, file:/D:/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar, file:/D:/repository/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar, file:/D:/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar, file:/D:/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar, file:/D:/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar, file:/D:/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar, file:/D:/repository/org/springframework/boot/spring-boot-starter-actuator/2.2.5.RELEASE/spring-boot-starter-actuator-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.2.5.RELEASE/spring-boot-actuator-autoconfigure-2.2.5.RELEASE.jar, file:/D:/repository/org/springframework/boot/spring-boot-actuator/2.2.5.RELEASE/spring-boot-actuator-2.2.5.RELEASE.jar, file:/D:/repository/io/micrometer/micrometer-core/1.3.5/micrometer-core-1.3.5.jar, file:/D:/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar, file:/D:/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar, file:/D:/repository/org/springframework/cloud/spring-cloud-context/2.2.3.RELEASE/spring-cloud-context-2.2.3.RELEASE.jar, file:/D:/repository/org/springframework/security/spring-security-crypto/5.2.2.RELEASE/spring-security-crypto-5.2.2.RELEASE.jar, file:/D:/repository/cn/hutool/hutool-all/5.3.5/hutool-all-5.3.5.jar, file:/D:/repository/de/codecentric/spring-boot-admin-starter-client/2.2.3/spring-boot-admin-starter-client-2.2.3.jar, file:/D:/repository/de/codecentric/spring-boot-admin-client/2.2.3/spring-boot-admin-client-2.2.3.jar, file:/F:/soft/idea/idea/lib/idea_rt.jar, file:/F:/soft/idea/idea/plugins/java/lib/rt/debugger-agent.jar]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.5.RELEASE)

11:26:51 [main] DEBUG c.c.f.a.s.b.ApolloApplicationContextInitializer - Apollo bootstrap config is not enabled for context org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1eb2d371, started on Thu Jan 01 08:00:00 CST 1970, parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@669253b7, see property: ${apollo.bootstrap.enabled}
11:26:51 [main] INFO  com.nisbos.goods.GoodsApplication - No active profile set, falling back to default profiles: default
11:26:51 [main] DEBUG o.s.boot.SpringApplication - Loading source class com.nisbos.goods.GoodsApplication,class org.springframework.cloud.bootstrap.BootstrapApplicationListener$BootstrapMarkerConfiguration
11:26:51 [main] DEBUG o.s.b.c.c.ConfigFileApplicationListener - Loaded config file 'file:/E:/nisbos-cloud/nisbos-springcloud/nisbos-springcloud-example/nisbos-springcloud-example-goods/nisbos-springcloud-example-goods-biz/target/classes/application.yml' (classpath:/application.yml)
11:26:51 [main] DEBUG o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1eb2d371
11:26:51 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
11:26:51 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory'
11:26:51 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner - Identified candidate component class: file [E:\nisbos-cloud\nisbos-springcloud\nisbos-springcloud-example\nisbos-springcloud-example-goods\nisbos-springcloud-example-goods-biz\target\classes\com\nisbos\goods\controller\EgGoodsController.class]

3、當專案中同時存在logback.xml和application.yml,同種類包日誌級別配置以哪個為準?

以logback.xml配置的日誌級別為準

這個就不貼驗證過程了

結論

當專案中同時在application.yml和logback.xml、logback-spring.xml配置同種類包日誌級別時,以logback-spring.xml、logback.xml配置的日誌級別為準

延展

細心的朋友可能會發現我分別用logback-spring.xml、logback.xml來驗證。那logback-spring.xml和logback.xml這兩種檔案到底有什麼區別?


上面的圖片來源於springboot官網,從圖片我們可以得到幾點資訊,springboot官方推薦使用logback-spring.xml。理由是如果是用logback.xml,在標準的日誌存放的地方(比如src/main/resource),spring將無法完全控制日誌的初始化。其次如果使用logback.xml,則沒法使用springboot提供的一些擴充套件功能。比如你在logback.xml使用springProperty或者springProfile標籤時,將無法得到預期的效果

總結

其實我第一次在配置

logging.level.org.springframework.boot.autoconfigure: info

沒法去除啟動時輸出自動裝配日誌報告後,也曾利用搜索引擎尋找答案。然後得到的答案如下:

而且不止一篇都是說這麼配置。但我依然很固執沒按搜尋引擎那樣的說,把日誌級別調成ERROR。原因是我們控制檯保留完整的案發現場,他輸出日誌級別是debug,因此日誌級別調整成debug級別以上就行。

說這麼一段,除了想裝逼一下,更重要的是表達有時候控制檯輸出的東西其實已經告訴你破案的關鍵了。