fix(logger): sync dubbo-go logger facade during logger initialization#3345
Merged
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3345 +/- ##
===========================================
+ Coverage 46.76% 52.45% +5.68%
===========================================
Files 295 492 +197
Lines 17172 37793 +20621
===========================================
+ Hits 8031 19825 +11794
- Misses 8287 16367 +8080
- Partials 854 1601 +747 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
cool work 下次记得在issue里面先留言,这样我就可以直接assign给你了,要不有可能和别人干重复 |
Author
|
okok下次会记得的!-w-
|
Alanxtl
pushed a commit
that referenced
this pull request
May 30, 2026
…#3345) * fix(logger): sync dubbo-go logger facade in LoggerConfig.Init() * fix(logger): sync dubbo-go logger facade in config_loader init() * fix(logger): sync dubbo-go logger facade in initGlobalLogger() * test(logger): verify dubbo-go facade is synced after logger initialization * style(logger): fix import formatting
Alanxtl
pushed a commit
that referenced
this pull request
May 31, 2026
* fix(config): remove legacy protocol timeout fallback (#3326) * fix(config): remove legacy protocol timeout fallback * fix(config): avoid default timeout allocation * fix(config): preserve consumer timeout in reference config * test(config): satisfy testifylint in reference timeout test * fix(config): make protocol timeout default explicit * fix(config): centralize consumer timeout default * fix(config): keep consumer timeout default in global * Fix(config center)apollo context path error (#3331) * feat(test):Add TestGetAddressWithProtocolPrefixKeepsContext and find the error when user bring context path * fix(apollo):Fix the test func(getAddressWithProtocolPrefix) fix(context_path):fix getAddressWithProtolPrefix didn't handle context path * refator(config_center):cleanup-redundant-test * fix(test):删除不应该存在的文件 * feat():恢复测试并添加多种case * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix:修复url.Path = /问题并添加边缘测试;修复原来的不符合gofmt格式以通过CI --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix(logger): sync dubbo-go logger facade during logger initialization (#3345) * fix(logger): sync dubbo-go logger facade in LoggerConfig.Init() * fix(logger): sync dubbo-go logger facade in config_loader init() * fix(logger): sync dubbo-go logger facade in initGlobalLogger() * test(logger): verify dubbo-go facade is synced after logger initialization * style(logger): fix import formatting * refactor(logger): standardize logger format across codebase (#3344) * refactor(logger): standardize logger format in graceful_shutdown - Add [GracefulShutdown] prefix to all logger calls - Remove decoration symbols (---) from log messages - Change key format from "error: %v" / "--- %v" to "err=%v" - Lowercase first letter of all log message bodies * refactor(logger): standardize logger format in internal, metadata, metrics, otel - Add module prefixes: [Internal], [Metadata], [MetadataRPC], [MetadataReport][Etcd/Nacos/Zookeeper], [Metrics], [Metrics][Probe/Prometheus/RPC], [OTel][Trace] - Unify key format: "error: %v" / ": %v" / "err: %s" → "err=%v", "url: %s" → "url=%s" - Lowercase first letter of all log message bodies - Fix bug: logger.Error with non-string or extra args → logger.Errorf (listener.go, server.go, exporter.go) - Fix bug: logger.Errorf with no format args → logger.Error (metadata_service.go) - Fix bug: logger.Infof/Debugf with no format args → logger.Info/Debug (config.go, report.go) - Fix: err.Error() + %s → err + %v (nacos/report.go x2) * refactor(logger): standardize logger format in protocol directory - Unify prefixes as [Protocol], [Dubbo], [Dubbo][Codec/Hessian2/Impl/Exporter/Invoker], [Dubbo3], [GRPC], [GRPC][Client/Server/Exporter/Invoker], [Jsonrpc], [Jsonrpc][Server/Exporter/Invoker], [ProtocolWrapper], [Rest], [Rest][Config/Exporter/Server], [Triple], [Triple][Client/Server/Exporter/Invoker/CORS/Codec/Handler/Negotiation/Protocol/Health/OpenAPI] - Unify key format: "error: %v" / ": %v" / "error:{%v}" → "err=%v", "err: %v" → "err=%v" - Lowercase first letter of all log message bodies - Remove %+v format for non-Debug levels - Fix bug: logger.Error with error type → logger.Errorf (dubbo_codec.go, dubbo_protocol.go) - Fix bug: logger.Error/Info with extra args → logger.Errorf/Infof (rpc_status.go, jsonrpc/server.go) - Fix bug: logger.Infof/Debugf without format args → logger.Info/Debug (multiple files) - Fix bug: logger.Debug without format args → logger.Debugf (openapi/service.go) - Fix: err.Error() + %s → err + %v (dubbo3_protocol.go) * refactor(logger):standardize logger prefixes in metadata, metadata-report, Dubbo, and Triple protocol modules * refactor(logger): unify log format in proxy and registry packages - Add consistent [Proxy]/[Registry]/[Registry][<impl>] prefix to all log messages - Adopt key=value parameter style (err=%v, url=%s) for structured logging - Remove redundant descriptions and normalize punctuation across 30 files * refactor(logger): unify log format in remoting, server and loader modules - Add consistent [Loader]/[Server]/[Getty]/[Zookeeper]/[Etcdv3] prefixes - Adopt key=value parameter style (err=%v, url=%s) for structured logging - Remove trailing punctuation and redundant wording across 21 files * feat(tools): add loggercheck linter for log format consistency Introduce a static analysis tool that enforces the standardized logger conventions across the codebase: - Rule 1: logger.Info with format verbs → use logger.Infof - Rule 2: logger.Infof without format verbs → use logger.Info - Rule 3: logger.Infof(fmt.Sprintf(...)) → redundant, flatten to Infof - Rule 4: trailing \n / ... / ! in log messages → remove Integrated into make lint as the logger-check target. * refactor(logger): final touch, unfiy logger format in other places * fix(tools): remove unused variables in loggercheck to pass golangci-lint * refactor: revert (feat(tools): add loggercheck) and simplify registry log prefixes Remove loggercheck tool and its Makefile integration. Use [Registry] instead of [Registry][Protocol]/[Registry][Exposed] in core registry files; add [Registry][Mock] for mock registry * fix(logger): correct format verbs, variable names, and function calls * refactor(logger):modify prefix format --------- Co-authored-by: CAICAII <3360776475@qq.com> Co-authored-by: Yuxuan Lv <3656828039@qq.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Nene7ko_ <141395478+XnLemon@users.noreply.github.com>
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.



Description
Fixes #3339
在 logger 初始化阶段,dubbo-go 自身的 loggerfacade(
dubbo.apache.org/dubbo-go/v3/logger)从未被同步设置。初始化代码只调用了github.com/dubbogo/gost/log/logger.SetLogger()和getty.SetLogger(),导致 facade 内部的全局变量始终为nil用户调用
dubboLogger.SetLoggerLevel()时,facade 对 nil 做类型断言,静默返回 false ,日志级别调整完全不生效。修复内容:
fix(logger): sync dubbo-go logger facade in LoggerConfig.Init()修复
config/logger_config.go的Init()方法,在设置 gost logger 和 getty 的同时,同步设置 dubbo-gofacade。同时为两个 logger 包的 import 添加明确的 alias(
gostLogger/dubboLogger)避免包名歧义。fix(logger): sync dubbo-go logger facade in config_loader init()修复
config/config_loader.go的init()函数,程序启动时的默认 zap logger 同步设置到 dubbo-gofacade。
fix(logger): sync dubbo-go logger facade in initGlobalLogger()修复
instance_options_init.go的initGlobalLogger()方法,dubbo.NewInstance()初始化路径下同步设置dubbo-go facade。
test(logger): verify dubbo-go facade is synced after logger initialization新增测试覆盖:zap driver、logrus driver、zap + trace-integration 三条路径,验证 facade 初始化后不为
nil,且
SetLoggerLevel在 zap driver 下能正确生效(包括开启 trace-integration 时通过ZapCtxLoggerwrapper 的透传)。
Btw:
第一次提pr,辛苦reviewer了owo
Checklist
develop