首次启动项目,springboot项目使用org.springframework.boot.logging.logback.SpringBootJoranConfigurator类解析“logback-spring.xml”文件,注入application.yml配置项。logback配置scanPeriod属性,触发重新加载文件时,却使用了ch.qos.logback.classic.joran.JoranConfigurator类解析,此时无法注入application.yml配置项。
Comment From: wilkinsona
Google translation:
When starting the project for the first time, the springboot project uses the org.springframework.boot.logging.logback.SpringBootJoranConfigurator class to parse the "logback-spring.xml" file and inject the application.yml configuration items. When logback configures the scanPeriod property and triggers the reload of the file, it uses the ch.qos.logback.classic.joran.JoranConfigurator class for parsing, and the application.yml configuration item cannot be injected at this time.
Comment From: wilkinsona
Configuration scanning isn't supported when using logback-spring.xml: https://docs.spring.io/spring-boot/docs/2.7.0/reference/html/features.html#features.logging.logback-extensions.