{"id":130,"date":"2026-03-21T22:47:18","date_gmt":"2026-03-21T14:47:18","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/gateway-logging\/"},"modified":"2026-03-21T23:29:08","modified_gmt":"2026-03-21T15:29:08","slug":"gateway-logging","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/gateway-logging\/","title":{"rendered":"\u65e5\u5fd7"},"content":{"rendered":"<h1>\u65e5\u5fd7<\/h1>\n<p>\u9762\u5411\u7528\u6237\u7684\u6982\u89c8\uff08CLI + Control UI + \u914d\u7f6e\uff09\uff0c\u8bf7\u53c2\u9605 <a href=\"https:\/\/pa.yingzhi8.cn\/?p=172\">\/logging<\/a>\u3002<\/p>\n<p>OpenClaw \u6709\u4e24\u4e2a\u65e5\u5fd7&#8221;\u754c\u9762&#8221;\uff1a<\/p>\n<ul>\n<li><strong>\u63a7\u5236\u53f0\u8f93\u51fa<\/strong>\uff08\u4f60\u5728\u7ec8\u7aef \/ Debug UI \u4e2d\u770b\u5230\u7684\u5185\u5bb9\uff09\u3002<\/li>\n<li><strong>\u6587\u4ef6\u65e5\u5fd7<\/strong>\uff08JSON \u884c\uff09\u7531 Gateway \u7f51\u5173 \u7f51\u5173\u65e5\u5fd7\u8bb0\u5f55\u5668\u5199\u5165\u3002<\/li>\n<\/ul>\n<h2>\u57fa\u4e8e\u6587\u4ef6\u7684\u65e5\u5fd7\u8bb0\u5f55\u5668<\/h2>\n<ul>\n<li>\u9ed8\u8ba4\u6eda\u52a8\u65e5\u5fd7\u6587\u4ef6\u4f4d\u4e8e <code>\/tmp\/openclaw\/<\/code> \u4e0b\uff08\u6bcf\u5929\u4e00\u4e2a\u6587\u4ef6\uff09\uff1a<code>openclaw-YYYY-MM-DD.log<\/code><\/li>\n<li>\u65e5\u671f\u4f7f\u7528 Gateway \u7f51\u5173 \u7f51\u5173\u4e3b\u673a\u7684\u672c\u5730\u65f6\u533a\u3002<\/li>\n<li>\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84\u548c\u7ea7\u522b\u53ef\u4ee5\u901a\u8fc7 <code>~\/.openclaw\/openclaw.json<\/code> \u914d\u7f6e\uff1a<\/li>\n<li><code>logging.file<\/code><\/li>\n<li><code>logging.level<\/code><\/li>\n<\/ul>\n<p>\u6587\u4ef6\u683c\u5f0f\u662f\u6bcf\u884c\u4e00\u4e2a JSON \u5bf9\u8c61\u3002<\/p>\n<p>Control UI \u7684 Logs \u6807\u7b7e\u9875\u901a\u8fc7 Gateway \u7f51\u5173 \u7f51\u5173\uff08<code>logs.tail<\/code>\uff09\u5c3e\u968f\u6b64\u6587\u4ef6\u3002CLI \u4e5f\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\nopenclaw logs &#8211;follow<\/p>\n<pre><code>\n**Verbose \u4e0e\u65e5\u5fd7\u7ea7\u522b**\n\n* **\u6587\u4ef6\u65e5\u5fd7**\u5b8c\u5168\u7531 `logging.level` \u63a7\u5236\u3002\n* `--verbose` \u4ec5\u5f71\u54cd**\u63a7\u5236\u53f0\u8be6\u7ec6\u7a0b\u5ea6**\uff08\u548c WS \u65e5\u5fd7\u6837\u5f0f\uff09\uff1b\u5b83**\u4e0d\u4f1a**\u63d0\u9ad8\u6587\u4ef6\u65e5\u5fd7\u7ea7\u522b\u3002\n* \u8981\u5728\u6587\u4ef6\u65e5\u5fd7\u4e2d\u6355\u83b7\u4ec5 verbose \u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u5c06 `logging.level` \u8bbe\u7f6e\u4e3a `debug` \u6216 `trace`\u3002\n\n## \u63a7\u5236\u53f0\u6355\u83b7\n\nCLI \u6355\u83b7 `console.log\/info\/warn\/error\/debug\/trace` \u5e76\u5c06\u5b83\u4eec\u5199\u5165\u6587\u4ef6\u65e5\u5fd7\uff0c\u540c\u65f6\u4ecd\u6253\u5370\u5230 stdout\/stderr\u3002\n\n\u4f60\u53ef\u4ee5\u72ec\u7acb\u8c03\u6574\u63a7\u5236\u53f0\u8be6\u7ec6\u7a0b\u5ea6\uff1a\n\n* `logging.consoleLevel`\uff08\u9ed8\u8ba4 `info`\uff09\n* `logging.consoleStyle`\uff08`pretty` | `compact` | `json`\uff09\n\n## \u5de5\u5177\u6458\u8981\u8131\u654f\n\n\u8be6\u7ec6\u5de5\u5177\u6458\u8981\uff08\u4f8b\u5982 `\ud83d\udee0\ufe0f Exec: ...`\uff09\u53ef\u4ee5\u5728\u8fdb\u5165\u63a7\u5236\u53f0\u6d41\u4e4b\u524d\u5c4f\u853d\u654f\u611f\u4ee4\u724c\u3002\u8fd9**\u4ec5\u9650\u5de5\u5177**\uff0c\u4e0d\u4f1a\u66f4\u6539\u6587\u4ef6\u65e5\u5fd7\u3002\n\n* `logging.redactSensitive`\uff1a`off` | `tools`\uff08\u9ed8\u8ba4\uff1a`tools`\uff09\n* `logging.redactPatterns`\uff1a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\u4e32\u6570\u7ec4\uff08\u8986\u76d6\u9ed8\u8ba4\u503c\uff09\n  * \u4f7f\u7528\u539f\u59cb\u6b63\u5219\u5b57\u7b26\u4e32\uff08\u81ea\u52a8 `gi`\uff09\uff0c\u6216\u5982\u679c\u4f60\u9700\u8981\u81ea\u5b9a\u4e49\u6807\u5fd7\u5219\u4f7f\u7528 `\/pattern\/flags`\u3002\n  * \u5339\u914d\u9879\u901a\u8fc7\u4fdd\u7559\u524d 6 \u4e2a + \u540e 4 \u4e2a\u5b57\u7b26\uff08\u957f\u5ea6 &gt;= 18\uff09\u6765\u5c4f\u853d\uff0c\u5426\u5219\u4e3a `***`\u3002\n  * \u9ed8\u8ba4\u503c\u6db5\u76d6\u5e38\u89c1\u7684\u952e\u8d4b\u503c\u3001CLI \u6807\u5fd7\u3001JSON \u5b57\u6bb5\u3001bearer \u5934\u3001PEM \u5757\u548c\u6d41\u884c\u7684\u4ee4\u724c\u524d\u7f00\u3002\n\n## Gateway \u7f51\u5173 WebSocket \u65e5\u5fd7\n\nGateway \u7f51\u5173\u4ee5\u4e24\u79cd\u6a21\u5f0f\u6253\u5370 WebSocket \u534f\u8bae\u65e5\u5fd7\uff1a\n\n* **\u666e\u901a\u6a21\u5f0f\uff08\u65e0 `--verbose`\uff09**\uff1a\u4ec5\u6253\u5370&quot;\u6709\u8da3\u7684&quot;RPC \u7ed3\u679c\uff1a\n  * \u9519\u8bef\uff08`ok=false`\uff09\n  * \u6162\u8c03\u7528\uff08\u9ed8\u8ba4\u9608\u503c\uff1a`&gt;= 50ms`\uff09\n  * \u89e3\u6790\u9519\u8bef\n* **\u8be6\u7ec6\u6a21\u5f0f\uff08`--verbose`\uff09**\uff1a\u6253\u5370\u6240\u6709 WS \u8bf7\u6c42\/\u54cd\u5e94\u6d41\u91cf\u3002\n\n### WS \u65e5\u5fd7\u6837\u5f0f\n\n`openclaw gateway` \u652f\u6301\u6bcf\u4e2a Gateway \u7f51\u5173\u7684\u6837\u5f0f\u5207\u6362\uff1a\n\n* `--ws-log auto`\uff08\u9ed8\u8ba4\uff09\uff1a\u666e\u901a\u6a21\u5f0f\u5df2\u4f18\u5316\uff1b\u8be6\u7ec6\u6a21\u5f0f\u4f7f\u7528\u7d27\u51d1\u8f93\u51fa\n* `--ws-log compact`\uff1a\u8be6\u7ec6\u65f6\u4f7f\u7528\u7d27\u51d1\u8f93\u51fa\uff08\u914d\u5bf9\u7684\u8bf7\u6c42\/\u54cd\u5e94\uff09\n* `--ws-log full`\uff1a\u8be6\u7ec6\u65f6\u4f7f\u7528\u5b8c\u6574\u7684\u6bcf\u5e27\u8f93\u51fa\n* `--compact`\uff1a`--ws-log compact` \u7684\u522b\u540d\n\n\u793a\u4f8b\uff1a\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\n# \u4f18\u5316\u7684\uff08\u4ec5\u9519\u8bef\/\u6162\u8c03\u7528\uff09\nopenclaw gateway\n\n# \u663e\u793a\u6240\u6709 WS \u6d41\u91cf\uff08\u914d\u5bf9\uff09\nopenclaw gateway --verbose --ws-log compact\n\n# \u663e\u793a\u6240\u6709 WS \u6d41\u91cf\uff08\u5b8c\u6574\u5143\u6570\u636e\uff09\nopenclaw gateway --verbose --ws-log full\n<\/code><\/pre>\n<h2>\u63a7\u5236\u53f0\u683c\u5f0f\u5316\uff08\u5b50\u7cfb\u7edf\u65e5\u5fd7\uff09<\/h2>\n<p>\u63a7\u5236\u53f0\u683c\u5f0f\u5316\u5668\u662f <strong>TTY \u611f\u77e5\u7684<\/strong>\uff0c\u6253\u5370\u4e00\u81f4\u7684\u5e26\u524d\u7f00\u884c\u3002\u5b50\u7cfb\u7edf\u65e5\u5fd7\u8bb0\u5f55\u5668\u4fdd\u6301\u8f93\u51fa\u5206\u7ec4\u4e14\u6613\u4e8e\u626b\u63cf\u3002<\/p>\n<p>\u884c\u4e3a\uff1a<\/p>\n<ul>\n<li>\u6bcf\u884c\u90fd\u6709<strong>\u5b50\u7cfb\u7edf\u524d\u7f00<\/strong>\uff08\u4f8b\u5982 <code>[gateway]<\/code>\u3001<code>[canvas]<\/code>\u3001<code>[tailscale]<\/code>\uff09<\/li>\n<li><strong>\u5b50\u7cfb\u7edf\u989c\u8272<\/strong>\uff08\u6bcf\u4e2a\u5b50\u7cfb\u7edf\u7a33\u5b9a\uff09\u52a0\u4e0a\u7ea7\u522b\u7740\u8272<\/li>\n<li><strong>\u5f53\u8f93\u51fa\u662f TTY \u6216\u73af\u5883\u770b\u8d77\u6765\u50cf\u5bcc\u7ec8\u7aef\u65f6\u7740\u8272<\/strong>\uff08<code>TERM<\/code>\/<code>COLORTERM<\/code>\/<code>TERM_PROGRAM<\/code>\uff09\uff0c\u9075\u5b88 <code>NO_COLOR<\/code><\/li>\n<li><strong>\u7f29\u77ed\u7684\u5b50\u7cfb\u7edf\u524d\u7f00<\/strong>\uff1a\u5220\u9664\u524d\u5bfc <code>gateway\/<\/code> + <code>channels\/<\/code>\uff0c\u4fdd\u7559\u6700\u540e 2 \u4e2a\u6bb5\uff08\u4f8b\u5982 <code>whatsapp\/outbound<\/code>\uff09<\/li>\n<li><strong>\u6309\u5b50\u7cfb\u7edf\u7684\u5b50\u65e5\u5fd7\u8bb0\u5f55\u5668<\/strong>\uff08\u81ea\u52a8\u524d\u7f00 + \u7ed3\u6784\u5316\u5b57\u6bb5 <code>{ subsystem }<\/code>\uff09<\/li>\n<li><strong><code>logRaw()<\/code><\/strong> \u7528\u4e8e QR\/UX \u8f93\u51fa\uff08\u65e0\u524d\u7f00\uff0c\u65e0\u683c\u5f0f\u5316\uff09<\/li>\n<li><strong>\u63a7\u5236\u53f0\u6837\u5f0f<\/strong>\uff08\u4f8b\u5982 <code>pretty | compact | json<\/code>\uff09<\/li>\n<li><strong>\u63a7\u5236\u53f0\u65e5\u5fd7\u7ea7\u522b<\/strong>\u4e0e\u6587\u4ef6\u65e5\u5fd7\u7ea7\u522b\u5206\u5f00\uff08\u5f53 <code>logging.level<\/code> \u8bbe\u7f6e\u4e3a <code>debug<\/code>\/<code>trace<\/code> \u65f6\uff0c\u6587\u4ef6\u4fdd\u7559\u5b8c\u6574\u8be6\u60c5\uff09<\/li>\n<li><strong>WhatsApp \u6d88\u606f\u6b63\u6587<\/strong>\u4ee5 <code>debug<\/code> \u7ea7\u522b\u8bb0\u5f55\uff08\u4f7f\u7528 <code>--verbose<\/code> \u67e5\u770b\u5b83\u4eec\uff09<\/li>\n<\/ul>\n<p>\u8fd9\u4fdd\u6301\u73b0\u6709\u6587\u4ef6\u65e5\u5fd7\u7a33\u5b9a\uff0c\u540c\u65f6\u4f7f\u4ea4\u4e92\u5f0f\u8f93\u51fa\u6613\u4e8e\u626b\u63cf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65e5\u5fd7 \u9762\u5411\u7528\u6237\u7684\u6982\u89c8\uff08CLI + Control UI + \u914d\u7f6e\uff09\uff0c\u8bf7\u53c2\u9605 \/logging\u3002 OpenCla [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-130","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":2,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"predecessor-version":[{"id":843,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/130\/revisions\/843"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}