Skip to content

router config upgrade sends logs to stdout by default, making its output challenging to use #8474

@glasser

Description

@glasser

Describe the bug

router config upgrade prints the upgraded YAML file to stdout. However, at least in the default configuration, it also prints log lines describing necessary upgrades to stdout, which makes it challenging to actually use the output. For example, you can't just do router config upgrade config.yaml | router config validate /dev/stdin because of the log line.

To Reproduce

❯ cat config.yaml
telemetry:
  apollo:
    preview_subgraph_metrics: true
❯ mise x [email protected] -- router config  upgrade config.yaml 2>/dev/null | cat
{"timestamp":"2025-10-22T20:59:58.542650000Z","level":"ERROR","message":"router configuration contains unsupported options and needs to be upgraded to run the router: \n\n  1. Subgraph metrics are now GA\n\n","target":"apollo_router::configuration::upgrade","resource":{}}
telemetry:
  apollo:
    subgraph_metrics: true

Expected behavior

I expect when running a command that is specifically designed to print a config file to stdout, that error logs will not also be sent to stdout. You can see above that the error log is not going to stderr (as I am piping that to /dev/null).

It would be good if these error logs went to stderr. That said, "logs go to stdout by default and can't be sent to stderr" seems like a pretty basic property of Router (and it's hard to configure the config validate command because it acts on config rather than being configured by config).

So maybe router config upgrade should get an output file flag, and ideally the flag should be required as the stdout behavior is a bit of an attractive nuisance otherwise.

Workaround

You can disable the log with RUST_LOG=none (but not with APOLLO_ROUTER_LOG=none or --log=none, apparently), though it might be nice to be able to see the logs!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions