Skip to content

fix: opt into fixed klog stderrthreshold behavior#596

Open
pierluigilenoci wants to merge 1 commit intoFairwindsOps:masterfrom
pierluigilenoci:fix/honor-stderrthreshold
Open

fix: opt into fixed klog stderrthreshold behavior#596
pierluigilenoci wants to merge 1 commit intoFairwindsOps:masterfrom
pierluigilenoci:fix/honor-stderrthreshold

Conversation

@pierluigilenoci
Copy link

Summary

  • After klog.InitFlags(), set legacy_stderr_threshold_behavior=false and stderrthreshold=INFO so that klog honors the stderrthreshold flag correctly.
  • This opts into the fix from kubernetes/klog#212, which corrects the default behavior where stderrthreshold was effectively ignored.
  • No dependency bump needed: the repo already uses k8s.io/klog/v2 v2.140.0.

Why

Without this fix, all log messages (including low-severity ones) are written to stderr regardless of the stderrthreshold setting. The new legacy_stderr_threshold_behavior flag was introduced in klog v2.140.0 to allow consumers to opt into the corrected behavior without breaking existing deployments.

Test plan

  • Verify the project builds successfully (go build ./...)
  • Verify that log messages below ERROR are no longer unconditionally written to stderr

/cc @sudermanjr @rbren

After klog.InitFlags(), set legacy_stderr_threshold_behavior=false
and stderrthreshold=INFO so that klog honors the stderrthreshold
flag correctly (kubernetes/klog#212).

The repo already uses klog/v2 v2.140.0, so no dependency bump
is needed.

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
@CLAassistant
Copy link

CLAassistant commented Mar 26, 2026

CLA assistant check
All committers have signed the CLA.

@pierluigilenoci
Copy link
Author

recheck

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.

2 participants