zeroclaw-labs/zeroclaw

zeroclaw should log to stderr instead of stdout

Open

#4721 opened on Mar 26, 2026

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Rust (31,341 stars) (4,614 forks)batch import
bugchannel: clicorehelp wantedobservabilityobservability:logpriority:p2risk: mediumstatus:acceptedstatus:no-stale

Description

I was surprised to see that zeroclaw logs to stdout instead of stderr. This makes it hard to use the output of commands like zeroclaw config schema becaues it includes logs in the output:

zeroclaw config schema 2>/dev/null | head
2026-03-26T02:06:56.927469Z  INFO zeroclaw::config::schema: Config loaded path=/home/zeroclaw/.zeroclaw/config.toml workspace=/home/zeroclaw/.zeroclaw/workspace source="default" initialized=true
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Config",
  "description": "Top-level ZeroClaw configuration, loaded from `config.toml`.\n\nResolution order: `ZEROCLAW_WORKSPACE` env → `active_workspace.toml` marker → `~/.zeroclaw/config.toml`.",
  "type": "object",
  "properties": {
    "agent": {
      "description": "Agent orchestration settings (`[agent]`).",
      "$ref": "#/$defs/AgentConfig",

If you pass the output of zeroclaw config schema to jq, it will fail to parse. Of course, you can change to a higher log level with RUST_LOG=fatal zeroclaw config schema but logging to stderr is a best practice and lets you still see logs while piping stdout to another process.

I'm happy to open a PR to change the logging to stderr if you agree. It's as simple as adding a line to change the output from the default of io::stdout to io::stderr here:

https://github.com/zeroclaw-labs/zeroclaw/blob/be1d9c846baa3cc6bb251e2da33a8186fc173d70/src/main.rs#L849-L854

You just need to add this to the method call chain:

    .with_writer(std::io::stderr)

Contributor guide