{ "title": "Logging", "content": "For a user-facing overview (CLI + Control UI + config), see [/logging](/logging).\n\nOpenClaw has two log “surfaces”:\n\n* **Console output** (what you see in the terminal / Debug UI).\n* **File logs** (JSON lines) written by the gateway logger.\n\n* Default rolling log file is under `/tmp/openclaw/` (one file per day): `openclaw-YYYY-MM-DD.log`\n * Date uses the gateway host's local timezone.\n* The log file path and level can be configured via `~/.openclaw/openclaw.json`:\n * `logging.file`\n * `logging.level`\n\nThe file format is one JSON object per line.\n\nThe Control UI Logs tab tails this file via the gateway (`logs.tail`).\nCLI can do the same:\n\n**Verbose vs. log levels**\n\n* **File logs** are controlled exclusively by `logging.level`.\n* `--verbose` only affects **console verbosity** (and WS log style); it does **not**\n raise the file log level.\n* To capture verbose-only details in file logs, set `logging.level` to `debug` or\n `trace`.\n\nThe CLI captures `console.log/info/warn/error/debug/trace` and writes them to file logs,\nwhile still printing to stdout/stderr.\n\nYou can tune console verbosity independently via:\n\n* `logging.consoleLevel` (default `info`)\n* `logging.consoleStyle` (`pretty` | `compact` | `json`)\n\n## Tool summary redaction\n\nVerbose tool summaries (e.g. `🛠️ Exec: ...`) can mask sensitive tokens before they hit the\nconsole stream. This is **tools-only** and does not alter file logs.\n\n* `logging.redactSensitive`: `off` | `tools` (default: `tools`)\n* `logging.redactPatterns`: array of regex strings (overrides defaults)\n * Use raw regex strings (auto `gi`), or `/pattern/flags` if you need custom flags.\n * Matches are masked by keeping the first 6 + last 4 chars (length >= 18), otherwise `***`.\n * Defaults cover common key assignments, CLI flags, JSON fields, bearer headers, PEM blocks, and popular token prefixes.\n\n## Gateway WebSocket logs\n\nThe gateway prints WebSocket protocol logs in two modes:\n\n* **Normal mode (no `--verbose`)**: only “interesting” RPC results are printed:\n * errors (`ok=false`)\n * slow calls (default threshold: `>= 50ms`)\n * parse errors\n* **Verbose mode (`--verbose`)**: prints all WS request/response traffic.\n\n`openclaw gateway` supports a per-gateway style switch:\n\n* `--ws-log auto` (default): normal mode is optimized; verbose mode uses compact output\n* `--ws-log compact`: compact output (paired request/response) when verbose\n* `--ws-log full`: full per-frame output when verbose\n* `--compact`: alias for `--ws-log compact`", "code_samples": [ { "code": "**Verbose vs. log levels**\n\n* **File logs** are controlled exclusively by `logging.level`.\n* `--verbose` only affects **console verbosity** (and WS log style); it does **not**\n raise the file log level.\n* To capture verbose-only details in file logs, set `logging.level` to `debug` or\n `trace`.\n\n## Console capture\n\nThe CLI captures `console.log/info/warn/error/debug/trace` and writes them to file logs,\nwhile still printing to stdout/stderr.\n\nYou can tune console verbosity independently via:\n\n* `logging.consoleLevel` (default `info`)\n* `logging.consoleStyle` (`pretty` | `compact` | `json`)\n\n## Tool summary redaction\n\nVerbose tool summaries (e.g. `🛠️ Exec: ...`) can mask sensitive tokens before they hit the\nconsole stream. This is **tools-only** and does not alter file logs.\n\n* `logging.redactSensitive`: `off` | `tools` (default: `tools`)\n* `logging.redactPatterns`: array of regex strings (overrides defaults)\n * Use raw regex strings (auto `gi`), or `/pattern/flags` if you need custom flags.\n * Matches are masked by keeping the first 6 + last 4 chars (length >= 18), otherwise `***`.\n * Defaults cover common key assignments, CLI flags, JSON fields, bearer headers, PEM blocks, and popular token prefixes.\n\n## Gateway WebSocket logs\n\nThe gateway prints WebSocket protocol logs in two modes:\n\n* **Normal mode (no `--verbose`)**: only “interesting” RPC results are printed:\n * errors (`ok=false`)\n * slow calls (default threshold: `>= 50ms`)\n * parse errors\n* **Verbose mode (`--verbose`)**: prints all WS request/response traffic.\n\n### WS log style\n\n`openclaw gateway` supports a per-gateway style switch:\n\n* `--ws-log auto` (default): normal mode is optimized; verbose mode uses compact output\n* `--ws-log compact`: compact output (paired request/response) when verbose\n* `--ws-log full`: full per-frame output when verbose\n* `--compact`: alias for `--ws-log compact`\n\nExamples:", "language": "unknown" } ], "headings": [ { "level": "h2", "text": "File-based logger", "id": "file-based-logger" }, { "level": "h2", "text": "Console capture", "id": "console-capture" }, { "level": "h2", "text": "Tool summary redaction", "id": "tool-summary-redaction" }, { "level": "h2", "text": "Gateway WebSocket logs", "id": "gateway-websocket-logs" }, { "level": "h3", "text": "WS log style", "id": "ws-log-style" } ], "url": "llms-txt#logging", "links": [] }