fix #3995 Configuring logging.level in bootstrap. yml file does not work - #4069
Closed
herodotus-ecosystem wants to merge 1 commit into
Closed
fix #3995 Configuring logging.level in bootstrap. yml file does not work#4069herodotus-ecosystem wants to merge 1 commit into
herodotus-ecosystem wants to merge 1 commit into
Conversation
This was referenced Sep 25, 2025
Author
|
之前基于 2023.x 分支提交了一个相同的 PR #4007 ,因为不小心把 fork 的工程删了,就自动关闭了。所以基于 2025.x 分支,重新又提交了一把。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe what this PR does / why we need it
在 Bootstrap 环境下,没有找到任何
PropertySourceLocator。Spring Cloud 就不会加载 Bootstrap.xml 中的相关配置了,特别是 logging.level。源代码如下:因此,只要保证在 Bootstrap 阶段,让
com.alibaba.cloud.nacos.client.NacosPropertySourceLocator注入即可。这与 2023.0.1.2 版本,即没有提取 spring-alibaba-nacos-config 模块前的版本逻辑一致。Does this pull request fix one issue?
Fixes #3995
Describe how you did it
主要做了两项变更
把
NacosPropertySourceLocatorBean 的配置,从NacosConfigSpringCloudAutoConfiguration迁移至NacosConfigSpringCloudBootstrapConfiguration配置中。因为 spring.factories 中已经配置了NacosConfigSpringCloudBootstrapConfiguration在 Bootstrap 阶段配置在 org.springframework.boot.autoconfigure.AutoConfiguration.imports 中添加了
NacosConfigSpringCloudBootstrapConfiguration配置,以保证其正确注入。Describe how to verify it
在配置文件层面验证方法:
在 boostrap.yml 添加以下 Spring Boot 标准配置,可以控制日志的显示
在调试代码方面:
Debug 代码,在
org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration类中设置断点,查看启动时该类 中的propertySourceLocatorslist 中是否已经注入了NacosPropertySourceLocatorSpecial notes for reviews