openclaw - ✅(Solved) Fix CLI console.log output captured in structured log file, bypassing logging.level [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60164Fetched 2026-04-08 02:35:34
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1referenced ×1

When running CLI commands (e.g. openclaw channels list, openclaw status) while the gateway is running, the full CLI stdout output — including auth provider names, email addresses, and potentially secrets — is written to the structured JSON log file (/tmp/openclaw/openclaw-*.log). This happens regardless of the logging.level setting (even at warn).

Error Message

When running CLI commands (e.g. openclaw channels list, openclaw status) while the gateway is running, the full CLI stdout output — including auth provider names, email addresses, and potentially secrets — is written to the structured JSON log file (/tmp/openclaw/openclaw-*.log). This happens regardless of the logging.level setting (even at warn).

  1. Set logging.level to warn
  • Respect logging.level (not written when level is warn or above), or
  • logging.level: warn

Root Cause

When running CLI commands (e.g. openclaw channels list, openclaw status) while the gateway is running, the full CLI stdout output — including auth provider names, email addresses, and potentially secrets — is written to the structured JSON log file (/tmp/openclaw/openclaw-*.log). This happens regardless of the logging.level setting (even at warn).

Fix Action

Fixed

PR fix notes

PR #60184: fix(logging): respect logging.level when forwarding console output to file

Description (problem / solution / changelog)

Problem

enableConsoleCapture() in src/logging/console.ts intercepts all console.* calls and unconditionally forwards them to the file logger. The file logger is built via tslog's attachTransport, and tslog does not apply minLevel filtering to custom transports — the transport callback receives every log entry regardless of the configured minimum level.

As a result, console.log calls (mapped to "info" level) are always written to the structured JSON log file, even when the user has set logging.level: warn in their config. Auth provider names, email addresses, and other CLI output land in /tmp/openclaw/openclaw-*.log silently.

Fix

Gate the file-logger write behind isFileLogLevelEnabled(level), which already exists in logger.ts and evaluates the message's severity against the configured logging.level threshold:

if (isFileLogLevelEnabled(level as LogLevel)) {
  const resolvedLogger = getLoggerLazy();
  // ...write to file logger...
}

Console passthrough to stdout/stderr is not affected — only the structured file write is gated.

Test

  1. Set logging.level: warn in openclaw.json.
  2. Run openclaw channels list.
  3. Inspect /tmp/openclaw/openclaw-<date>.log.

Before: info-level entries with CLI output appear in the log.
After: no info-level entries; only warn/error/fatal messages are written.

Fixes #60164

Changed files

  • src/cron/isolated-agent/delivery-dispatch.named-agent.test.ts (modified, +2/-0)
  • src/logging/console.ts (modified, +17/-15)
RAW_BUFFERClick to expand / collapse

Summary

When running CLI commands (e.g. openclaw channels list, openclaw status) while the gateway is running, the full CLI stdout output — including auth provider names, email addresses, and potentially secrets — is written to the structured JSON log file (/tmp/openclaw/openclaw-*.log). This happens regardless of the logging.level setting (even at warn).

Reproduction

  1. Set logging.level to warn
  2. Run openclaw channels list
  3. Inspect /tmp/openclaw/openclaw-<date>.log
  4. The full CLI output appears as INFO-level entries with method: "console.log"

Expected behavior

CLI console.log output should either:

  • Respect logging.level (not written when level is warn or above), or
  • Not be intercepted by the structured logger at all (CLI commands should run out-of-process or bypass the log hook)

Security concern

The structured log is written to /tmp/ which, while permission-restricted, is a world-readable directory path. CLI output can contain sensitive information (auth provider emails, OAuth account names, channel configurations). This creates an unintended data leak vector.

Environment

  • OpenClaw 2026.4.1
  • macOS (launchd service)
  • logging.level: warn

extent analysis

TL;DR

Modify the logging configuration to prevent CLI output from being written to the structured JSON log file.

Guidance

  • Review the logging configuration to ensure that the logging.level setting is correctly applied to all log outputs, including CLI commands.
  • Consider modifying the log output to exclude sensitive information, such as auth provider names and email addresses.
  • Investigate the possibility of running CLI commands out-of-process or bypassing the log hook to prevent interception by the structured logger.
  • Verify that the log file permissions are set to prevent unauthorized access, despite being in a world-readable directory.

Example

No code snippet is provided as the issue does not imply a specific code change.

Notes

The solution may require changes to the OpenClaw logging configuration or the underlying logging mechanism. The exact steps may vary depending on the implementation details of the logging system.

Recommendation

Apply a workaround to modify the logging configuration to prevent sensitive information from being written to the log file, as upgrading to a fixed version is not implied in the issue. This is because the issue is specific to the current version (2026.4.1) and a fix is not mentioned.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

CLI console.log output should either:

  • Respect logging.level (not written when level is warn or above), or
  • Not be intercepted by the structured logger at all (CLI commands should run out-of-process or bypass the log hook)

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING