诊断标志

诊断标志

诊断标志让你能够在不打开全局详细日志的情况下启用有针对性的调试日志。标志是选择性加入的,除非子系统检查它们,否则不会产生任何效果。

工作原理

通过配置启用

{
  "diagnostics": {
    "flags": ["telegram.http"]
  }
}

多个标志:

{
  "diagnostics": {
    "flags": ["telegram.http", "gateway.*"]
  }
}

更改标志后重启 Gateway。

环境变量覆盖(一次性)

OPENCLAW_DIAGNOSTICS=telegram.http,telegram.payload

禁用所有标志:

OPENCLAW_DIAGNOSTICS=0

日志输出位置

标志将日志输出到标准诊断日志文件。默认位置:

/tmp/openclaw/openclaw-YYYY-MM-DD.log

如果设置了 logging.file,请使用该路径。日志格式为 JSONL(每行一个 JSON 对象)。
根据 logging.redactSensitive 设置,仍会进行敏感信息脱敏。

提取日志

选择最新的日志文件:

ls -t /tmp/openclaw/openclaw-*.log | head -n 1

过滤 Telegram HTTP 诊断日志:

rg "telegram http error" /tmp/openclaw/openclaw-*.log

或在复现时实时跟踪:

tail -f /tmp/openclaw/openclaw-$(date +%F).log | rg "telegram http error"

对于远程 Gateway,你也可以使用 openclaw logs --follow(详见 [/cli/logs(../cli/logs.html))。

备注