Skip to content
广告 · 本站推荐广告

openclaw logs

查看和管理 OpenClaw 运行日志。

概要

bash
openclaw logs [子命令] [选项]

描述

openclaw logs 命令用于查看 OpenClaw 运行过程中产生的各类日志信息,包括系统日志、Agent 日志和通道日志。支持实时跟踪、按级别过滤、按时间范围筛选等功能,方便快速排查问题。

子命令

子命令说明
show显示日志(默认)
clear清除历史日志
export导出日志到文件

选项

选项缩写说明默认值
--follow-f实时跟踪日志输出false
--level <level>-l过滤日志级别:debuginfowarnerrorinfo
--since <time>-s显示指定时间之后的日志,如 1h30m2d-
--until <time>-u显示指定时间之前的日志-
--lines <n>-n显示最近 n 条日志100
--source <name>按来源过滤:systemagentchannel全部
--format <type>输出格式:textjsontext

日志格式

默认文本格式如下:

[2026-03-05 10:23:45] [INFO]  [agent] 收到来自 WhatsApp 的消息
[2026-03-05 10:23:46] [DEBUG] [system] 调度模型:deepseek-chat
[2026-03-05 10:23:48] [INFO]  [agent] 回复已发送

示例

bash
# 查看最近日志
openclaw logs

# 实时跟踪日志
openclaw logs --follow

# 只看错误日志
openclaw logs --level error

# 查看最近 1 小时的调试日志
openclaw logs --level debug --since "1h"

# 只看 Agent 来源的日志,最近 50 条
openclaw logs --source agent --lines 50

# 导出日志到文件
openclaw logs export --since "1d" --format json > logs.json

# 清除 7 天前的日志
openclaw logs clear --before "7d"

相关命令

基于MIT协议开源 | 内容翻译自 官方文档,同步更新