mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-20 06:54:32 +00:00
fix: honor -stderrthreshold when -logtostderr is true (default)
klog v2 defaults -logtostderr to true, which silently ignores the -stderrthreshold flag — all log levels are unconditionally sent to stderr. This makes it impossible for log-aggregation systems to filter by severity. Bump klog to v2.140.0 and opt into the fixed behavior by setting legacy_stderr_threshold_behavior=false and stderrthreshold=INFO (which preserves current output while letting users override via CLI flags). Ref: kubernetes/klog#212, kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
This commit is contained in:
@@ -132,6 +132,11 @@ operations can also be performed as 'velero backup get' and 'velero schedule cre
|
||||
|
||||
// init and add the klog flags
|
||||
klog.InitFlags(flag.CommandLine)
|
||||
// Opt into the new klog behavior so that -stderrthreshold is honored even
|
||||
// when -logtostderr=true (the default).
|
||||
// Ref: kubernetes/klog#212, kubernetes/klog#432
|
||||
flag.CommandLine.Set("legacy_stderr_threshold_behavior", "false") //nolint:errcheck
|
||||
flag.CommandLine.Set("stderrthreshold", "INFO") //nolint:errcheck
|
||||
c.PersistentFlags().AddGoFlagSet(flag.CommandLine)
|
||||
|
||||
return c
|
||||
|
||||
Reference in New Issue
Block a user