-
Notifications
You must be signed in to change notification settings - Fork 742
[BugFix] Fix legacy logger propagation leaking unformatted logs to stderr #7617
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
base: develop
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -181,6 +181,12 @@ def setup_logging(log_dir=None, config_file=None): | |||||||||||
| # Ensure log directory exists | ||||||||||||
| Path(log_dir).mkdir(parents=True, exist_ok=True) | ||||||||||||
|
|
||||||||||||
| # Prevent implicit basicConfig() from adding a stderr handler when | ||||||||||||
| # module-level logging.info/warning() is called with no root handlers. | ||||||||||||
| # A NullHandler on root satisfies Python's "has handlers" check. | ||||||||||||
| if not logging.root.handlers: | ||||||||||||
| logging.root.addHandler(logging.NullHandler()) | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| # Prevent implicit basicConfig() from adding a stderr handler when | |
| # module-level logging.info/warning() is called with no root handlers. | |
| # A NullHandler on root satisfies Python's "has handlers" check. | |
| if not logging.root.handlers: | |
| logging.root.addHandler(logging.NullHandler()) |
Copilot
AI
Apr 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR 描述中写的是仅恢复 legacy logger 的 propagate=False 并更新测试,但实际还包含:修改 setup_logging(root NullHandler)、调整 OpenAI 入口的 uvicorn log_config/输出流、以及 scheduler_metrics_logger 输出流等。建议补充 PR 描述说明这些额外改动的动机与影响范围,或拆分为独立 PR,避免 reviewer/发布时遗漏风险评估。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当前 dictConfig 下同时把 "default"(stdout) 和 "error"(stderr) 两个 handler 绑定到 uvicorn / uvicorn.error,但 "default" handler 没有过滤 ERROR 级别,导致 ERROR+ 日志会同时输出到 stdout 和 stderr(重复一份),与注释“ERROR+ logs go to stderr”不一致。建议给 stdout handler 增加“仅低于 ERROR”的 filter(或等价的过滤方案),确保 ERROR+ 只走 stderr。