fix(log): emit the buffered lines Flush() dropped - #3464
Draft
Dave Shoup (shouples) wants to merge 1 commit into
Draft
fix(log): emit the buffered lines Flush() dropped#3464Dave Shoup (shouples) wants to merge 1 commit into
Flush() dropped#3464Dave Shoup (shouples) wants to merge 1 commit into
Conversation
Flush replays buffered messages once verbosity is raised (a message logged before -v is parsed, say). The filter was `lm.level < l.Level`, but a higher Level value is more verbose, so it skipped exactly the messages now within the threshold and emitted the rest. Corrected to `>`, with a regression test that logs at DEBUG, raises verbosity, and asserts the message appears. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
|
Flush() dropped
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.



Release Notes
Bug Fixes
-v) dropping buffered log lines it should have emitted, and emitting the low-priority ones instead.Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.Applies to both Cloud and Platform (shared logging). Feature-flag items are N/A - this is a bug fix, not a gated feature.
What
The CLI buffers log lines and flushes them later (for example, to attach context to an error). The flush filter that decides which buffered lines to emit was inverted, so it dropped exactly the lines it should have kept - the more important, less verbose ones - and emitted the rest.
pkg/log/logger.go'sFlush()hadif lm.level < l.Level { continue }. Higher level values mean more verbose, so a buffered line should be emitted when its level is at or below the current threshold (lm.level <= l.Level), not skipped when it is below. The one-character fix flips the comparison to>, and a regression test pins the behavior so it cannot silently invert again.Same command at
-vvv(verbosity =DEBUG), with four lines buffered before verbosity was parsed:(
TRACEis correctly withheld in both - it is more verbose than the requestedDEBUG.)Applies to: both Confluent Cloud and Confluent Platform (shared logging code).
Blast Radius
Very small, and confined to diagnostic logging. The logger writes only to stderr, and
Flush()runs once at startup purely for its logging side effect - it returns nothing and touches no command result, exit code, or stdout, so machine-readable output (-o json/-o yaml) is unaffected. If the filter were wrong, the effect is limited to which buffered lines land on stderr, and only in the under-emitting direction: the per-level emit methods re-gate each line, so a wrong filter still cannot surface a line more verbose than the active level (credential-bearingUNSAFE_TRACEoutput stays gated behind--unsafe-traceregardless). No customer-facing command would break.References
migrate-mocker-to-mockgenbase; part of a small logging-fix stack.Test & Review
pkg/log/logger_test.goassertingFlush()emits buffered lines at or below the threshold and drops the more-verbose ones.-vvvv, the same command emitted 0 buffered[DEBUG]lines before the fix and 4 after.go test ./pkg/log/...passes.