Skip to content

serverboot: dynamic --log-level flag for the server binaries - #677

Merged
Max Smythe (maxsmythe) merged 4 commits into
agent-substrate:mainfrom
igooch:serverboot-log-level
Aug 1, 2026
Merged

serverboot: dynamic --log-level flag for the server binaries#677
Max Smythe (maxsmythe) merged 4 commits into
agent-substrate:mainfrom
igooch:serverboot-log-level

Conversation

@igooch

@igooch igooch commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Adds a dynamic --log-level flag (debug, info, warn, error; case-insensitive) to
the server binaries, backed by a slog.LevelVar in serverboot. Defaults to
info — no behavior change unless the flag is set.

  • serverboot: the LevelVar behind InitLogger's handler; SetLogLevel(string)
    to parse and set it (empty string = unset, a documented no-op); LogLevel()
    returns a slog.Leveler for binaries that build their own handler.
  • atelet, ateapi: new pflag, fatal on an invalid value.
  • ateom-gvisor, ateom-microvm: flag accepted by the binary; note their
    container args are built by the WorkerPool controller with no pass-through yet,
    so wiring it is a follow-up — and that follow-up must roll out only after this
    change's ateom images are deployed (older images reject unknown flags and would
    crashloop).
  • atenet (router + dns): replaces two pre-existing hand-rolled --log-level
    parsers that silently fell back to info on a bad value; both now use
    serverboot.SetLogLevel and serverboot.InitLogger, which also adds
    ate.dev/trace-id correlation to atenet logs.
  • Kind manifests: atelet runs at --log-level=debug on kind (dev/CI), so e2e
    suites can assert on per-item log lines; production installs keep info.

Motivation: groundwork for #463 Phase 2 observability — per-item GC log lines can
ship at Debug and be enabled per-node instead of landing at Info.

Testing: unit tests pin the untouched default at exactly info, dynamic
raise/lower, case-insensitivity, invalid-value rejection, and the empty-string
no-op; go test -race green across serverboot, atenet, atelet, ateapi.

igooch added 4 commits July 31, 2026 16:03
A slog.LevelVar behind the serverboot loggers, settable from a new
--log-level flag (debug, info, warn, error) in atelet, ateapi,
ateom-gvisor, and ateom-microvm. Defaults to info — no behavior
change unless the flag is set.

Groundwork for demoting per-item GC log lines to Debug (agent-substrate#463 Phase 2
observability): once this lands, chatty diagnostic lines can ship at
Debug and still be enabled per-node when needed.

ateom-gvisor builds its own handler (shared synced writer); it honors
the same level via serverboot.LogLevel().
Kind installs are dev/CI; debug there lets e2e suites assert on
per-item log lines while production installs keep the info default.
…, default-is-info test

- atenet's router and dns subcommands had their own --log-level with a
  hand-rolled switch that silently fell back to info on a bad value;
  both now go through serverboot.SetLogLevel, so an invalid value is an
  error everywhere the flag exists. Empty string is documented as unset
  (no-op) — programmatic configs that never set the field keep the
  default.
- LogLevel() returns slog.Leveler instead of *slog.LevelVar, keeping
  SetLogLevel the only mutation path.
- Test pins the untouched default at exactly info, and the empty-string
  no-op.

Note on the ateom binaries: they accept --log-level but their container
args are constructed by the WorkerPool controller (workerpool_apply.go)
with no pass-through, so the flag is unreachable there until a
follow-up wires it. That wiring must roll out only after this change's
ateom images are deployed — older images reject unknown flags and
would crashloop.
Replaces the duplicated handler construction and picks up the
contextlogging wrapper, so atenet log lines carry ate.dev/trace-id
like the other binaries — the router initializes tracing right after
this point, so span IDs now correlate with logs.

@maxsmythe Max Smythe (maxsmythe) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maxsmythe
Max Smythe (maxsmythe) merged commit d016edd into agent-substrate:main Aug 1, 2026
11 checks passed
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.

2 participants