Skip to content

[Feature] Add logging parameters and error output to terminal#7098

Open
xyxinyang wants to merge 1 commit intoPaddlePaddle:developfrom
xyxinyang:dev-log-v2
Open

[Feature] Add logging parameters and error output to terminal#7098
xyxinyang wants to merge 1 commit intoPaddlePaddle:developfrom
xyxinyang:dev-log-v2

Conversation

@xyxinyang
Copy link
Copy Markdown
Collaborator

@xyxinyang xyxinyang commented Mar 31, 2026

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

针对 FastDeploy 的日志系统进行优化,预计分 4 个 pr 完成。

pr 内容 状态
1 新增日志相关参数、错误同时输出到终端 当前 pr
2 日志通道划分、request.log 级别划分和聚合 待提交
3 worker_process.log、cache_manager.log、comm.log、paddle日志收敛和简化 待提交
4 trace.log 日志的规范化和整合 待提交

pr1 的错误输出是针对 work 的错误,其他错误输出终端需要在 pr2 划分通道中实现

Modifications

  1. 新增日志相关环境变量

    • 新增 FD_LOG_LEVEL、FD_LOG_REQUESTS、FD_LOG_REQUESTS_LEVEL、FD_LOG_MAX_LEN、FD_TRACE 环境变量
  2. 日志输出分流

    • 添加 MaxLevelFilter:INFO/DEBUG → stdout,ERROR/CRITICAL → stderr
    • 添加 console_stdoutconsole_stderr handlers
  3. Worker 启动失败错误展示优化

    • 添加 _read_latest_worker_traceback():读取 workerlog.* 中的 traceback
    • 添加 _format_worker_launch_failure_message():格式化错误消息
    • 修改 _stop_profile():返回 False 而非 raise RuntimeError,错误信息输出到终端
  4. 其他

    • DailyRotatingFileHandler._open() 添加 mkdir 确保目录存在

Usage or Command

新增环境变量

变量名 说明 默认值
FD_LOG_LEVEL 全局日志级别,优先于 FD_DEBUG INFO
FD_LOG_REQUESTS 请求日志总开关 1
FD_LOG_REQUESTS_LEVEL 请求日志详细级别 (0-3) 0
FD_LOG_MAX_LEN 请求日志字段截断最大长度 2048
FD_TRACE 统一 trace 开关:off/local/otel/all off

当前环境变量未生效,会在后续 pr2 - pr4 用到,同时后续 pr 会删除旧的日志参数:FD_DEBUG 和 TRACES_ENABLE

Accuracy Tests

本次 pr 新增的环境变量未生效,在后续 pr2 - pr4 逐步用到。

worker 错误输出:
image

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Mar 31, 2026

Thanks for your contribution!

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 82.50000% with 7 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@dd2aa10). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/engine/common_engine.py 79.16% 5 Missing ⚠️
fastdeploy/engine/engine.py 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #7098   +/-   ##
==========================================
  Coverage           ?   73.44%           
==========================================
  Files              ?      402           
  Lines              ?    56605           
  Branches           ?     8945           
==========================================
  Hits               ?    41573           
  Misses             ?    12090           
  Partials           ?     2942           
Flag Coverage Δ
GPU 73.44% <82.50%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants