日志
openclaw logs
Section titled “openclaw logs”通过 RPC 跟踪 Gateway(网关) 网关 文件日志(适用于远程模式)。
相关:
--limit <n>:要返回的日志行最大数量(默认为200)--max-bytes <n>:从日志文件中读取的最大字节数(默认为250000)--follow:跟踪日志流--interval <ms>:跟踪时的轮询间隔(默认为1000)--json:输出行分隔的 JSON 事件--plain:不带样式格式的纯文本输出--no-color:禁用 ANSI 颜色--local-time:以您的本地时区渲染时间戳(默认)--utc:以 UTC 渲染时间戳
共享 Gateway RPC 选项
Section titled “共享 Gateway RPC 选项”openclaw logsGateway(网关) 也接受标准的 Gateway 客户端标志:
--url <url>Gateway(网关):Gateway WebSocket URL--token <token>Gateway(网关):Gateway 令牌--timeout <ms>:超时时间(毫秒)(默认30000)--expect-finalGateway(网关):当 Gateway 调用由 agent 支持时,等待最终响应
当您传递 --urlCLI 时,CLI 不会自动应用配置或环境凭据。如果目标 Gateway 需要身份验证,请显式包含 --tokenGateway(网关)。
openclaw logsopenclaw logs --followopenclaw logs --follow --interval 2000openclaw logs --limit 500 --max-bytes 500000openclaw logs --jsonopenclaw logs --plainopenclaw logs --no-coloropenclaw logs --limit 500openclaw logs --local-timeopenclaw logs --utcopenclaw logs --follow --local-timeopenclaw logs --url ws://127.0.0.1:18789 --token "$OPENCLAW_GATEWAY_TOKEN"- 默认情况下,时间戳以您的本地时区显示。使用
--utc获取 UTC 输出。 - 如果隐式 local loopback Gateway 请求配对、在连接期间关闭或在 Gateway(网关)
logs.tail回答之前超时,openclaw logsGateway(网关) 将自动回退到配置的 Gateway 文件日志。显式--url目标不使用此回退。 openclaw logs --followGateway(网关)RPCLinuxGateway(网关)Gateway(网关) 在隐式本地 Gateway RPC 失败后不会遵循配置文件的回退。在 Linux 上,如果可用,它会按 PID 使用活动的 user-systemd Gateway 日志并打印所选日志源;否则它会继续重试活动的 Gateway,而不是跟踪可能过时的 side-by-side 文件。- 使用
--follow时,临时的 Gateway(网关) 断开连接(WebSocket 关闭、超时、连接中断)会触发自动重新连接,并采用指数退避策略(最多重试 8 次,每次尝试之间最多间隔 30 秒)。每次重试时会向 stderr 打印警告,一旦轮询成功,会打印[logs] gateway reconnected通知。在--json模式下,重试警告和重新连接转换都会作为{"type":"notice"}记录输出到 stderr。不可恢复的错误(身份验证失败、配置错误)仍会立即退出。