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#6999] Solve the problem that Nacos client does not support logback overload log configuration #8229

Merged
merged 11 commits into from
Apr 27, 2022

Conversation

hujun-w-2
Copy link
Collaborator

@hujun-w-2 hujun-w-2 commented Apr 21, 2022

Please do not create a Pull Request without creating an issue first.

What is the purpose of the change

for #6999

Brief changelog

  1. rewrite JoranConfigurator to ensure that Nacos configuration does not affect user configuration savepoints and scanning url.
  2. Add a listener when loading the Nacos configuration. When the user configuration is overloaded, the Nacos configuration loading will be triggered.

Verifying this change

  1. When logback overload function is not used, Nacos SDK remote The log is printed normally, and the user log is printed normally
    2.. When using logback overload function, Nacos SDK remote The log is printed normally, and the user log is overloaded normally

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 requested a review from KomachiSion April 21, 2022 12:10
This reverts commit b5f7a69.
@shalk
Copy link
Contributor

shalk commented Apr 22, 2022

i found #7596 make some bug, i did not figure it out .
In my case , when you change log level dynamic for nacos , it will not take effect with new context . so you should take good are of either logger in the same context. maybe the pr will fix my bug.

I do not know what the bug is for this pr ,

Is NacosContextInitializer and NacosJorndan neccesarry ? more ut or more description could make it clear

@hujun-w-2
Copy link
Collaborator Author

i found #7596 make some bug, i did not figure it out . In my case , when you change log level dynamic for nacos , it will not take effect with new context . so you should take good are of either logger in the same context. maybe the pr will fix my bug.

I do not know what the bug is for this pr ,

Is NacosContextInitializer and NacosJorndan neccesarry ? more ut or more description could make it clear

i found #7596 make some bug, i did not figure it out . In my case , when you change log level dynamic for nacos , it will not take effect with new context . so you should take good are of either logger in the same context. maybe the pr will fix my bug.

I do not know what the bug is for this pr ,

Is NacosContextInitializer and NacosJorndan neccesarry ? more ut or more description could make it clear

@hujun-w-2 hujun-w-2 closed this Apr 23, 2022
@hujun-w-2 hujun-w-2 reopened this Apr 23, 2022
@hujun-w-2
Copy link
Collaborator Author

i found #7596 make some bug, i did not figure it out . In my case , when you change log level dynamic for nacos , it will not take effect with new context . so you should take good are of either logger in the same context. maybe the pr will fix my bug.

I do not know what the bug is for this pr ,

Is NacosContextInitializer and NacosJorndan neccesarry ? more ut or more description could make it clear

The role of these two classes

  1. Rewrite the method of registration savepoint to ensure that the loading of Nacos configuration does not affect the application configuration savepoint
  2. Rewrite the configuration method without affecting the configuration path of logback automatic scanning

Copy link
Collaborator

@KomachiSion KomachiSion left a comment

Choose a reason for hiding this comment

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

Why not rewrite registerSafeConfiguration and informContextOfURLUsedForConfiguration in NacosJoranConfigurator.java?

@hujun-w-2 hujun-w-2 changed the title Client logback bug bak Solve the problem that Nacos client does not support logback overload log configuration Apr 26, 2022
@hujun-w-2 hujun-w-2 changed the title Solve the problem that Nacos client does not support logback overload log configuration [ISSUE#6999] Solve the problem that Nacos client does not support logback overload log configuration Apr 26, 2022
@hujun-w-2
Copy link
Collaborator Author

Why not rewrite registerSafeConfiguration and informContextOfURLUsedForConfiguration in NacosJoranConfigurator.java?

  1. Informcontextofurlusedforconfiguration is static and cannot be rewritten.
  2. The nacoscontextinitializer has been removed.

@KomachiSion KomachiSion added this to the 2.1.0 milestone Apr 27, 2022
@KomachiSion KomachiSion added the area/Client Related to Nacos Client SDK label Apr 27, 2022
@KomachiSion KomachiSion merged commit 98d1221 into alibaba:develop Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Client Related to Nacos Client SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants