Skip to content

refactor(logging): delete the init logger - #16705

Open
Joibel wants to merge 5 commits into
refactor/server-env-configfrom
refactor/delete-init-logger
Open

refactor(logging): delete the init logger#16705
Joibel wants to merge 5 commits into
refactor/server-env-configfrom
refactor/delete-init-logger

Conversation

@Joibel

@Joibel Joibel commented Aug 13, 2026

Copy link
Copy Markdown
Member

Part 3 of 3: with #16702 and #16703 having moved every config read into constructors, nothing needs to log before main anymore — so the init logger can be deleted outright.

Motivation

The init logger has been a source of subtle process-global behavior: #15863 / #16693 (its signal handler made the v4 controller and server ignore SIGTERM entirely), hidden os.Exit control flow inside a logging package, and buffered messages whose replay depended on construction order. With no remaining producers, deleting it removes the whole class.

Modifications

  • New cmdutil.FatalBootstrap(logFormat, err, msg) for the one thing the init logger still did in production: reporting "failed to construct the logger" and exiting. It honors the requested log format when parseable (an improvement — the old path hardcoded JSON) and falls back to JSON when the format flag itself is the invalid input.
  • All eight fatal-bootstrap call sites across workflow-controller, argo, and argoexec converted to it; the previously implicit exits (one site had no explicit exit and relied on the init logger's hidden one) are now uniform and explicit.
  • E2E fixtures and three argoexec command test files switch from InitLogger contexts to the standard test-logger helpers (logging.TestContext / logging.NewTestLogger).
  • util/logging/init.go and init_test.go deleted; NewSlogLoggerCustom no longer replays init logs. GetExitFunc/SetExitFunc remain (still used by the slog fatal path, argo lint, and FatalBootstrap). Removed exported API: logging.InitLogger, logging.InitLoggerInContext.

Verification

go build ./..., golangci-lint (0 issues), go test ./util/... ./cmd/... -count=1 pass (one pre-existing, unrelated TestEmissary/Sub-process environment failure reproduces identically on the parent commit). Functional checks: workflow-controller --loglevel bogus prints one text-format error line (honoring the default --log-format text) and exits 1; with --log-format json the line is JSON. A repo-wide grep confirms zero references to InitLogger/initLog/emitInitLogs outside vendor.

Documentation

Not needed: no user-facing interface changes; bootstrap failure output now matches the documented --log-format flag instead of ignoring it.

AI

Claude Code planned and implemented this change under human direction, with per-task and whole-branch review passes; the author reviewed and takes responsibility for the result.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SqVAUnuPJZ7sQZCy44bBSE

@Joibel Joibel changed the title refactor/delete init logger refactor(logging): delete the init logger Aug 13, 2026
Joibel added 5 commits August 13, 2026 15:50
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
@Joibel
Joibel force-pushed the refactor/delete-init-logger branch from 75eef19 to a3d60de Compare August 13, 2026 14:51
@Joibel
Joibel marked this pull request as ready for review August 14, 2026 09:54
@Joibel
Joibel requested a review from a team as a code owner August 14, 2026 09:54
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.

1 participant