macOS Logging: Rolling Diagnostics File and Unified Logs

Learn how to enable and manage the rolling diagnostics log on macOS, and export unified logs as JSON. This page is for users who need to troubleshoot or inspect OpenClaw's logging output.

Read this when

  • Capturing macOS logs or investigating private data logging
  • Debugging voice wake/session lifecycle issues

Logging (macOS)

Rolling diagnostics file log (Debug pane)

The macOS application uses swift-log for its logging (unified logging is the default) and optionally maintains a rotating on-disk log file for persistent storage (DiagnosticsFileLog).

  • Turn it on: Debug pane -> Logs -> App logging -> "Write rolling diagnostics log (JSONL)" (disabled by default).
  • Detail level: Debug pane -> Logs -> App logging -> Verbosity selector.
  • Where it lives: ~/Library/Logs/OpenClaw/diagnostics.jsonl.
  • Rotation: rotates once it hits 5 MB; up to 5 backups named .1....5 are kept (oldest gets discarded).
  • Wipe: Debug pane -> Logs -> App logging -> "Clear" removes the current file plus every backup.

Handle this file with care; never share it without inspecting it first.

Export unified logs as JSON

Execute ./scripts/clawlog.sh --json to output recent unified-log entries as a single JSON array to stdout, or append --output logs.json to send that array to a file instead of the terminal. By default the output holds the last 50 log records; switch to --lines 1 for just the newest record or --all to include all matching records. In JSON mode, --lines tallies complete records, not raw lines.

JSON export is incompatible with --follow and --list-categories. Apply those flags without --json.

Unified logging private data on macOS

Unless a subsystem explicitly opts in via privacy -off, unified logging masks most payloads. A plist in /Library/Preferences/Logging/Subsystems/ controls this, keyed by subsystem name. The setting only affects newly created log entries, so activate it before you try to reproduce the problem. Background reading: macOS logging privacy shenanigans.

Enable for OpenClaw (ai.openclaw)

Start by writing the plist to a temporary file, then install it atomically as root:

cat <<'EOF' >/tmp/ai.openclaw.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>DEFAULT-OPTIONS</key>
    <dict>
        <key>Enable-Private-Data</key>
        <true/>
    </dict>
</dict>
</plist>
EOF
sudo install -m 644 -o root -g wheel /tmp/ai.openclaw.plist /Library/Preferences/Logging/Subsystems/ai.openclaw.plist

A restart is unnecessary; logd picks up the change quickly, yet only fresh log lines carry the private payloads. Inspect the enriched output with ./scripts/clawlog.sh --category WebChat --last 5m (--last/-l narrows the time window, default 5m; --category/-c filters by category).

Disable after debugging

  • Delete the override: sudo rm /Library/Preferences/Logging/Subsystems/ai.openclaw.plist.
  • Optionally run sudo log config --reload to make logd drop the override right away.
  • This surface may expose phone numbers and message content; leave the plist installed only for as long as you truly need it.
415 words · updated Aug 25, 2026