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

Nacos-Client log print to application logs, not print to nacos' log #3133

Closed
KomachiSion opened this issue Feb 2, 2023 · 4 comments
Closed
Assignees
Labels

Comments

@KomachiSion
Copy link

Which Component
Nacos Discovery/Config

Describe the bug
Relative issue #1931.

After the issue fix problem, the problem fixed by some old version.

But in some new version, the problem started again. After my debug and research. I fount that the problem is caused by the spring will call the LoggingSystem.initialize from PropertySourceBootstrapConfiguration after all ApplicationEnvironmentPreparedEvent.

But NacosLoggingListener in Nacos Discovery/Config only handle ApplicationEnvironmentPreparedEvent not loadConfiguration again after PropertySourceBootstrapConfiguration. So the log config still be overwrite by spring.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'nacos-discovery-spring-cloud-config-client-example' in tag 2.2.9.RELEASE
  2. Run on 'SpringCloudConfigClientApplication'
  3. See nacos client log print into console.

Expected behavior
nacos client log print into ${user.home}/naming.log or config.log

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.
MacOS 、Java8 、 Version 2.2.6.RELEASE ~ 2.2.9.RELEASE

I don't test for 2021.X and 2022.X. Please community to check and fix.

@steverao steverao self-assigned this Feb 3, 2023
@wang3develop
Copy link

Environment 环境

  • JDK:17
  • SpringToolSuite:4.17.0.release
  • spring.cloud.version:2022.0.1/2022.0.0
  • spring.cloud.alibaba.version:2022.0.0.0-RC1

Launch启动

图片

Question问题

我在YAML、PROPERTIES、JVM、ENV尝试了配置参数都不能令其消失,这应该如何进行配置?
I tried configuration parameters in YAML,PROPERTIES,JVM and ENV but couldn't make them disappear. What should I do?

@ruansheng8
Copy link
Collaborator

ruansheng8 commented Feb 18, 2023

In Spring Boot 2.4 and later versions, StaticLoggerBinder was removed from logback-classic 1.3.x version, so it will cause NoClassDefFoundError exception.

See more details: alibaba/nacos#9970

ruansheng8 added a commit to ruansheng8/spring-cloud-alibaba that referenced this issue Feb 18, 2023
@ruansheng8
Copy link
Collaborator

The console logs are not printed correctly to the nacos log file because the LogbackLoggingSystem reset the LoggerContext in the prepareContext phase of the SpringApplication. Fixed in PR #3160

ruansheng8 added a commit to ruansheng8/spring-cloud-alibaba that referenced this issue Feb 21, 2023
ruansheng8 added a commit to ruansheng8/spring-cloud-alibaba that referenced this issue Feb 21, 2023
ruansheng8 added a commit to ruansheng8/spring-cloud-alibaba that referenced this issue Feb 21, 2023
@github-actions
Copy link

github-actions bot commented Jul 5, 2023

This issue has been open 30 days with no activity. This will be closed in 7 days.

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

No branches or pull requests

4 participants