Migrate from klog v1 to klog/v2 and honor stderrthreshold#7364
Migrate from klog v1 to klog/v2 and honor stderrthreshold#7364pierluigilenoci wants to merge 1 commit intoredhat-developer:mainfrom
Conversation
Replace deprecated k8s.io/klog with k8s.io/klog/v2 and opt into the fixed stderrthreshold behavior introduced in klog/v2 v2.140.0. Without this fix, the -stderrthreshold flag is silently ignored when -logtostderr=true (klog's default), making it impossible to filter log output by severity. Also fix klog.V() boolean check to use klog.V().Enabled() for klog/v2 API compatibility. See: kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
✅ Deploy Preview for odo-docusaurus-preview canceled.
|
|
Hi @pierluigilenoci. Thanks for your PR. I'm waiting for a redhat-developer member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
|
Closing in favor of #7363 which was created first. Sorry for the duplicate. |



What type of PR is this?
Bug fix / Dependency update
What does this PR do?
Migrate from deprecated
k8s.io/klog(v1) tok8s.io/klog/v2and opt intothe fixed stderrthreshold behavior introduced in klog/v2 v2.140.0.
Without this fix, the
-stderrthresholdflag is silently ignoredwhen
-logtostderr=true(klog's default), making it impossible tofilter log output by severity.
Changes
"k8s.io/klog"imports with"k8s.io/klog/v2"across 80+ source filesk8s.io/klog/v2from v2.100.1 to v2.140.0 in go.modklog.V(4)boolean check toklog.V(4).Enabled()for klog/v2 API compatibilityklog.InitFlags(nil), setlegacy_stderr_threshold_behavior=falseandstderrthreshold=INFOgo mod tidyandgo mod vendorHow should this be tested?
go build ./...passesgo vet ./...passesReferences