Honor stderrthreshold when logtostderr is enabled#782
Conversation
Bump k8s.io/klog/v2 to v2.140.0 and opt out of the legacy stderr threshold behavior so that -stderrthreshold is respected even when -logtostderr=true (the default). Set stderrthreshold=INFO to preserve current behavior; users can now override it on the command line. Ref: kubernetes/klog#212, kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
|
Hi — friendly ping. Is this PR still on the radar for review? Happy to rebase or make changes if needed. Thanks! |
|
Hi — friendly follow-up. The CI failures appear to be infrastructure-related (the image build can't push to ghcr.io from a fork PR, and integration tests depend on that image). The code changes themselves are minimal (klog v2 dependency update). Would you be able to review when you get a chance? Thank you! |
|
Hi — friendly follow-up on this PR. The CI seems to be failing due to a permissions issue when the workflow tries to push to Would it be possible to either:
Happy to make any code changes needed on my end. Thanks! |
What
Bump
k8s.io/klog/v2to v2.140.0 and opt out of the legacy stderr threshold behavior so that-stderrthresholdis respected even when-logtostderr=true(the klog v2 default).Why
klog v2 defaults
-logtostderrtotrue, which silently ignores-stderrthreshold. All log levels are unconditionally sent to stderr, making severity-based filtering impossible for log aggregation systems.This was reported in kubernetes/klog#212 and fixed upstream in kubernetes/klog#432.
How
klog.InitFlags(nil)inmain()to register klog flags on the standard flag setlegacy_stderr_threshold_behavior=falseto opt into the corrected behaviorstderrthreshold=INFOas default to preserve current behavior (all logs still go to stderr)-stderrthreshold=WARNINGor-stderrthreshold=ERROR