Skip to content

fix: honor --stderrthreshold flag when --logtostderr is enabled#2405

Merged
thomasferrandiz merged 1 commit intoflannel-io:masterfrom
pierluigilenoci:fix/honor-stderrthreshold
Mar 30, 2026
Merged

fix: honor --stderrthreshold flag when --logtostderr is enabled#2405
thomasferrandiz merged 1 commit intoflannel-io:masterfrom
pierluigilenoci:fix/honor-stderrthreshold

Conversation

@pierluigilenoci
Copy link
Copy Markdown
Contributor

What this PR does

When --logtostderr is enabled (the default in flannel), klog's legacy behavior silently ignores the --stderrthreshold flag. 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 override
  • stderrthreshold=INFO — preserves the current default behavior

After 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. Setting legacy_stderr_threshold_behavior=false eliminates this duplicate logging.

@pierluigilenoci
Copy link
Copy Markdown
Contributor Author

Hi @thomasferrandiz, @rbrtbnfgl — this small fix ensures the --stderrthreshold flag works correctly when --logtostderr is enabled (the default). Would you be willing to review? Thank you!

@manuelbuil
Copy link
Copy Markdown
Collaborator

manuelbuil commented Mar 30, 2026

@pierluigilenoci tests are failing

@thomasferrandiz
Copy link
Copy Markdown
Contributor

could you rebase on the latest master branch?
we had an issue with docker login which makes the workflows fail

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>
@thomasferrandiz thomasferrandiz force-pushed the fix/honor-stderrthreshold branch from e9fdb9c to b584613 Compare March 30, 2026 14:17
@pierluigilenoci
Copy link
Copy Markdown
Contributor Author

Rebased on latest master. All green now. Thanks @thomasferrandiz!

@thomasferrandiz thomasferrandiz merged commit 4464bb2 into flannel-io:master Mar 30, 2026
8 of 9 checks passed
@pierluigilenoci pierluigilenoci deleted the fix/honor-stderrthreshold branch March 30, 2026 16:05
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.

3 participants