Honor stderrthreshold when logtostderr is enabled#646
Honor stderrthreshold when logtostderr is enabled#646pierluigilenoci wants to merge 1 commit intocontainers:mainfrom
Conversation
After calling klog.InitFlags, opt into the fixed stderrthreshold behavior added in klog v2.140.0 so that severe-enough messages are still mirrored to stderr when logtostderr is set. Reference: kubernetes/klog#212 Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
|
cc @klihub @fmuyassarov for review |
klihub
left a comment
There was a problem hiding this comment.
@pierluigilenoci Thank you ! LGTM.
Is it so that all the dynamic controls we might exercise over klog when our configuration CR changes still works as before with the updated klog ?
|
@klihub Thanks for the review and great question! Yes, all dynamic controls over klog still work exactly as before. The Any runtime changes to klog verbosity levels (via In short: this is a one-time startup flag that fixes the default behavior; all dynamic reconfiguration paths remain unchanged. |
Summary
klog.InitFlags, opt into the fixedstderrthresholdbehavior introduced in klog v2.140.0k8s.io/klog/v2from v2.130.1 to v2.140.0pkg/log/klogcontrol/klogcontrol.go(the init function that configures klog flags)Motivation
When
logtostderris enabled (the default), klog historically suppressed thestderrthresholdflag, meaning thatWARNINGandERRORmessages could not be selectively filtered. klog v2.140.0 introduced new flags (legacy_stderr_threshold_behavior) to opt into the corrected behavior wherestderrthresholdis properly honored.Reference: kubernetes/klog#212
Test plan
stderrthresholdflag can be used to control which severity levels appear on stderr