fix: honor stderrthreshold when logtostderr is enabled#192
fix: honor stderrthreshold when logtostderr is enabled#192pierluigilenoci wants to merge 1 commit intowarm-metal:mainfrom
Conversation
|
cc @kitt1987 @mugdha-adhav — would appreciate your review on this klog fix. Thanks! |
|
Thanks for the PR @pierluigilenoci! I looked into the linked klog#432 and had a question. klog v2.140.0 introduces I noticed your other downstream PRs (secrets-store-csi-driver, metrics-server, etc.) all include Do we need to add it for this fix to take effect? |
Since kubernetes/klog#432, the legacy behavior of copying WARNING and above to stderr when logtostderr=true is deprecated. Explicitly set stderrthreshold=INFO so that all log levels continue to appear on stderr as expected. Also bumps k8s.io/klog/v2 from v2.130.1 to v2.140.0. See: kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
82a4619 to
f30b786
Compare
|
Good catch @mugdha-adhav! I've added |
|
Friendly follow-up — @mugdha-adhav thank you for the great feedback earlier! I addressed your question about |
Summary
Since kubernetes/klog#432, klog changed its legacy behavior: when
logtostderr=true(the default in this driver), WARNING and ERROR messages are no longer duplicated to stderr unless you explicitly opt in.This PR:
flag.Set("stderrthreshold", "INFO")right after the existingflag.Set("logtostderr", "true")call, so that all log severities continue to appear on stderr as expected.k8s.io/klog/v2from v2.130.1 to v2.140.0.Why
Without this fix, users relying on stderr output (e.g. for log aggregation pipelines,
kubectl logs, or sidecar log collectors) may silently lose WARNING and ERROR messages on stderr.Test plan
go build ./cmd/plugin/succeedsReferences