zeroclaw-labs/zeroclaw

zeroclaw should log to stderr instead of stdout

Open

#4.721 aberto em 26 de mar. de 2026

Ver no GitHub
 (3 comments) (0 reactions) (1 assignee)Rust (4.614 forks)batch import
bugchannel: clicorehelp wantedobservabilityobservability:logpriority:p2risk: mediumstatus:acceptedstatus:no-stale

Métricas do repositório

Stars
 (31.341 stars)
Métricas de merge de PR
 (Mesclagem média 3d 17h) (778 fundiu PRs em 30d)

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)

Guia do colaborador