fix(cli): keep dirctl logs off stdout - #2016
Open
dlanov wants to merge 1 commit into
Open
Conversation
Signed-off-by: Dennis Lanov <dennis.lanov@gmail.com>
dlanov
force-pushed
the
fix-2009-dirctl-log-stderr
branch
from
August 12, 2026 17:07
6f549ca to
db6d54d
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Fixes #2009.
Summary
Keep
dirctldiagnostic logs off stdout so machine-readable command output can be safely piped or redirected.dirctllogging to stderr.dirctl daemon start, apiserver, and reconciler.DIRECTORY_LOGGER_LOG_STREAM=stdout|stderrfor explicit stream selection.DIRECTORY_LOGGER_LOG_FILEas the highest-priority logging destination.Behavior
With no explicit log stream:
dirctlcommands log to stderrdirctl daemon startcontinues logging to stdoutExplicit
DIRECTORY_LOGGER_LOG_STREAMoverrides the binary default, while a validDIRECTORY_LOGGER_LOG_FILEoverrides both.This keeps JSON, JSONL, raw, and binary command results clean on stdout.
Testing
go test -race -count=10 ./logging/...go test -race -count=1 ./cmd/... ./presenter/...go build ./...for cli, server, and reconcilergo vet ./...for cli, server, reconciler, and utils/logginggit diff --checkManual verification confirmed:
dirctl: logs on stderr, stdout cleanLOG_STREAM=stdout: logs on stdoutLOG_STREAM=stderr: logs on stderrLOG_FILEtakes precedence overLOG_STREAMdirctl daemon startretains stdout logging