Skip to content

Fix/rolling logger#1105

Merged
AlexStocks merged 3 commits into
apache:mainfrom
Snow-kal:fix/rolling-logger
May 15, 2026
Merged

Fix/rolling logger#1105
AlexStocks merged 3 commits into
apache:mainfrom
Snow-kal:fix/rolling-logger

Conversation

@Snow-kal
Copy link
Copy Markdown
Contributor

变更内容

修复 logger/rolling 样例运行后未生成 logs.log 的问题。

主要修改:

  • logger/rolling/conf/dubbogo.yml 中增加 appender: file

    • dubbo-go logger 默认 appenderconsole
    • 仅配置 logger.file 不会自动启用文件输出
    • 显式设置 appender: file 后,日志会写入 logs.log
  • 调整 logger/rolling/cmd/main.go 的日志输出频率

    • 每轮日志输出后增加 time.Sleep(time.Second * 1)
    • 与其他 logger 样例保持一致
    • 避免 3 秒内过快刷日志导致样例行为不直观
  • 更新 logger/README.mdlogger/README_zh.md

    • 说明文件输出需要配置 appender: file
    • 说明从 logger/rolling 目录运行时,logs.log 会生成在 logger/rolling/logs.log
    • 补充如需同时输出控制台和文件,可使用 appender: console,file

验证方式

在 PowerShell 中执行:

cd logger/rolling
$env:DUBBO_GO_CONFIG_PATH = "./conf/dubbogo.yml"
go run ./cmd/main.go
Get-ChildItem .\logs.log
Get-Content .\logs.log -Tail 20
image

issue #1075

Copilot AI review requested due to automatic review settings May 10, 2026 12:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the logger/rolling sample so it actually writes logs to logs.log by explicitly enabling the file appender, and adjusts sample output pacing to match the other logger examples.

Changes:

  • Add appender: file to logger/rolling/conf/dubbogo.yml so file output is enabled.
  • Slow down the rolling sample’s log loop with a 1s sleep per iteration.
  • Update logger/README.md and logger/README_zh.md to document the need for appender: file and clarify log file location.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
logger/rolling/conf/dubbogo.yml Enables file appender so the rolling sample creates logs.log.
logger/rolling/cmd/main.go Adds a 1s delay per loop to make sample output behavior more readable/consistent.
logger/README.md Documents appender: file and log file location (needs clarification on config root key).
logger/README_zh.md Same as above for the Chinese README (needs clarification on config root key).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread logger/README.md
Comment thread logger/README_zh.md
@AlexStocks AlexStocks merged commit cdbe76b into apache:main May 15, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants