Skip to content

fix: 将日志输出改为写入文件,避免干扰stdio MCP通信#2

Open
donnel666 wants to merge 1 commit intomasterfrom
fix/logging-to-file
Open

fix: 将日志输出改为写入文件,避免干扰stdio MCP通信#2
donnel666 wants to merge 1 commit intomasterfrom
fix/logging-to-file

Conversation

@donnel666
Copy link
Copy Markdown
Owner

问题

在 Factory Droid 中使用 uart-mcp 时会出现断流(会话突然终止,无报错)。

原因分析

原日志配置使用 logging.basicConfig() 输出到 stderr,在 MCP stdio 模式下会干扰 JSON-RPC 协议通信。

修复方案

  • 添加 _setup_logging() 函数将日志输出到文件
  • 日志文件位置:~/.uart-mcp/uart-mcp.log
  • 移除默认的 stderr 处理器

- 添加 _setup_logging() 函数配置日志输出到文件
- 日志文件位置:~/.uart-mcp/uart-mcp.log
- 移除默认的 stderr 处理器,防止干扰 JSON-RPC 协议

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
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.

1 participant