refactor(logging): delete the init logger - #16705
Open
Joibel wants to merge 5 commits into
Open
Conversation
This was referenced Aug 13, 2026
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
force-pushed
the
refactor/delete-init-logger
branch
from
August 13, 2026 14:51
75eef19 to
a3d60de
Compare
Joibel
marked this pull request as ready for review
August 14, 2026 09:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3 of 3: with #16702 and #16703 having moved every config read into constructors, nothing needs to log before
mainanymore — 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.Exitcontrol 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
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.workflow-controller,argo, andargoexecconverted 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.InitLoggercontexts to the standard test-logger helpers (logging.TestContext/logging.NewTestLogger).util/logging/init.goandinit_test.godeleted;NewSlogLoggerCustomno longer replays init logs.GetExitFunc/SetExitFuncremain (still used by the slog fatal path,argo lint, andFatalBootstrap). Removed exported API:logging.InitLogger,logging.InitLoggerInContext.Verification
go build ./...,golangci-lint(0 issues),go test ./util/... ./cmd/... -count=1pass (one pre-existing, unrelatedTestEmissary/Sub-processenvironment failure reproduces identically on the parent commit). Functional checks:workflow-controller --loglevel bogusprints one text-format error line (honoring the default--log-format text) and exits 1; with--log-format jsonthe line is JSON. A repo-wide grep confirms zero references toInitLogger/initLog/emitInitLogsoutside vendor.Documentation
Not needed: no user-facing interface changes; bootstrap failure output now matches the documented
--log-formatflag 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