Skip to content

Decouple error reporting from logging#956

Open
dandavison wants to merge 3 commits intomainfrom
no-logging
Open

Decouple error reporting from logging#956
dandavison wants to merge 3 commits intomainfrom
no-logging

Conversation

@dandavison
Copy link
Contributor

@dandavison dandavison commented Feb 28, 2026

Fixes #567

What was changed

  • When executing short-lived transactional commands (e.g. start, list etc, as opposed to the long-running server start-dev process) report errors/warnings as unstructured plain text instead of structured logging-formatted messages.
  • By default do not log at all (except for server start-dev)

Why?

CLIs should report errors/warnings by printing to stderr. They should not use structured logging messages for this.

How was this tested

  • New in-codebase tests
  • Manually.

A script to manually repro/verify this change is in the git history of this branch. It shows, for example

Scenario: Try to connect to unavailable port

Before

time=2026-03-01T13:05:37.748 level=ERROR msg="failed reaching server: connection error: desc = \"transport: Error while dialing: dial tcp 127.0.0.1:1: connect: connection refused\""

After

Error: failed reaching server: connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:1: connect: connection refused"

Scenario: setting env kv pairs

Before

time=2026-03-01T13:05:37.982 level=INFO msg="Setting env property" env=myenv property=foo value=bar
 time=2026-03-01T13:05:37.982 level=INFO msg="Writing env file" file=/path/to/my/env/file

After
[no output]

The Fail callback was routing errors through the slog logger, which meant:
- Errors appeared as structured log messages (with timestamp and level)
- --log-level never silently swallowed errors
- --log-format json wrapped errors in JSON

Errors are now always printed directly to stderr as "Error: <message>",
independent of log configuration.

Default log level changed from "info" to "never"; server start-dev
continues to default to "warn" via its existing ChangedFromDefault
override. Users can still opt in with --log-level on any command.

Two deprecation warnings (namespace arg, env command args) converted
from logger calls to direct stderr writes so they remain visible
regardless of log level.
@dandavison dandavison marked this pull request as ready for review March 1, 2026 19:00
@dandavison dandavison requested review from a team as code owners March 1, 2026 19:00
@dandavison dandavison requested a review from chaptersix March 1, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Print to stderr instead of using a logger for warnings/errors

1 participant