Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #9860] abstract the nacos logback configurator to solve the problem between different version #9934

Merged
merged 6 commits into from
Feb 22, 2023

Conversation

hujun-w-2
Copy link
Collaborator

@hujun-w-2 hujun-w-2 commented Feb 11, 2023

issue:#9860
修改方案
1.通过判断高版本的类是否存在选择不同版本的api
2.通过spi的方式+新增logback-adapter的依赖解决不同版本api存在同一个项目中编译报错的问题,依赖项目https://github.com/nacos-group/logback-adpater
测试场景
1.2.9 版本的logback的demo服务使用该依赖启动可正常加载logback配置
1.4.5 版本的logback的demo服务使用该依赖启动可正常加载logback配置

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

@hujun-w-2 hujun-w-2 changed the title [ISSUE#9860]logback support 1.4.5 [ISSUE #9860] logback support 1.4.5 Feb 11, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2023

Codecov Report

Merging #9934 (6e27c82) into develop (8c90f89) will increase coverage by 3.14%.
The diff coverage is 26.31%.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #9934      +/-   ##
=============================================
+ Coverage      47.35%   50.50%   +3.14%     
- Complexity      4536     4837     +301     
=============================================
  Files            864      865       +1     
  Lines          28128    27506     -622     
  Branches        3138     3035     -103     
=============================================
+ Hits           13320    13891     +571     
+ Misses         13599    12389    -1210     
- Partials        1209     1226      +17     
Impacted Files Coverage Δ
.../logging/logback/NacosClientLogbackProperties.java 0.00% <0.00%> (ø)
...ing/logback/NacosLogbackConfiguratorAdapterV1.java 0.00% <0.00%> (ø)
...os/client/logging/logback/LogbackNacosLogging.java 22.85% <38.46%> (+8.04%) ⬆️
...in/java/com/alibaba/nacos/sys/utils/InetUtils.java 31.03% <0.00%> (-24.14%) ⬇️
...ing/core/v2/event/client/ClientOperationEvent.java 85.71% <0.00%> (-14.29%) ⬇️
.../plugin/auth/impl/jwt/NacosSignatureAlgorithm.java 69.56% <0.00%> (-4.95%) ⬇️
...cos/core/distributed/id/SnowFlowerIdGenerator.java 61.36% <0.00%> (-4.55%) ⬇️
...alibaba/nacos/client/config/impl/ClientWorker.java 51.08% <0.00%> (-4.52%) ⬇️
...ing/core/v2/index/ClientServiceIndexesManager.java 55.22% <0.00%> (-4.48%) ⬇️
... and 81 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c90f89...6e27c82. Read the comment docs.

@hujun-w-2 hujun-w-2 changed the title [ISSUE #9860] logback support 1.4.5 [ISSUE #9860] abstract the nacos logback configurator to solve the problem between different version Feb 11, 2023
*
* @author hujun
*/
public class NacosClientLogbackProperties implements NacosLogbackProperties {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the usage of NacosLogbackProperties?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前的版本有个nacos的NacosClientProperties xml标签适配了logback,但是NacosClientProperties在nacos-client包.
这样的目的是为了方便适配logback的组件(logback-adapter)可以在不依赖nacos-client包的情况下调用到NacosClientProperties,从而也能调用到NacosClientProperties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature type/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants