fix: honor --stderrthreshold flag when --logtostderr is enabled#2405
Merged
thomasferrandiz merged 1 commit intoflannel-io:masterfrom Mar 30, 2026
Merged
Conversation
Contributor
Author
|
Hi @thomasferrandiz, @rbrtbnfgl — this small fix ensures the |
manuelbuil
approved these changes
Mar 30, 2026
Collaborator
|
@pierluigilenoci tests are failing |
Contributor
|
could you rebase on the latest master branch? |
When logtostderr is enabled, klog's legacy behavior ignores the stderrthreshold flag. This opts into the fixed behavior introduced in klog v2.130.0 by setting legacy_stderr_threshold_behavior=false. See: kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
e9fdb9c to
b584613
Compare
Contributor
Author
|
Rebased on latest master. All green now. Thanks @thomasferrandiz! |
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.
What this PR does
When
--logtostderris enabled (the default in flannel), klog's legacy behavior silently ignores the--stderrthresholdflag. This means users cannot filter log output by severity level, even though the flag appears to be available.This PR opts into the fixed behavior introduced in klog v2.130.0 by setting:
legacy_stderr_threshold_behavior=false— disables the legacy overridestderrthreshold=INFO— preserves the current default behaviorAfter this change, users can set
--stderrthreshold=WARNING(or any level) and it will work as expected.Additionally, klog/v2 is bumped from v2.130.1 to v2.140.0 which includes the fix for kubernetes/klog#432.
Why
See upstream fix: kubernetes/klog#432
When
logtostderr=true, klog's legacy stderrthreshold behavior causes WARNING+ messages to be written to stderr twice — once via the logtostderr path and once via the legacy stderrthreshold path. Settinglegacy_stderr_threshold_behavior=falseeliminates this duplicate logging.