Skip to content

fix: honor klog -stderrthreshold even when -logtostderr is true#141

Open
pierluigilenoci wants to merge 1 commit intoahmetb:masterfrom
pierluigilenoci:fix/honor-stderrthreshold
Open

fix: honor klog -stderrthreshold even when -logtostderr is true#141
pierluigilenoci wants to merge 1 commit intoahmetb:masterfrom
pierluigilenoci:fix/honor-stderrthreshold

Conversation

@pierluigilenoci
Copy link
Copy Markdown

What

klog v2 defaults -logtostderr to true, which silently causes
-stderrthreshold to be ignored. This means users cannot filter which
severity levels are printed to stderr.

klog v2.140.0 introduced the legacy_stderr_threshold_behavior flag
(kubernetes/klog#432) to
decouple the two settings, as discussed in
kubernetes/klog#212.

Changes

  1. Bump k8s.io/klog/v2 from v2.130.1 to v2.140.0.
  2. Set legacy_stderr_threshold_behavior=false right after klog.InitFlags
    so that -stderrthreshold is honored even when -logtostderr=true.

Testing

  • go build ./... passes.
  • No behaviour change for users who do not pass -stderrthreshold; the
    default threshold (ERROR) is the same as before.

klog v2 defaults -logtostderr to true, which silently causes
-stderrthreshold to be ignored. klog v2.140.0 introduced the
legacy_stderr_threshold_behavior flag (kubernetes/klog#432) to
decouple the two settings.

Set legacy_stderr_threshold_behavior=false so that users can
control log verbosity on stderr via -stderrthreshold as expected.

Bump k8s.io/klog/v2 from v2.130.1 to v2.140.0 to pick up the fix.

Ref: kubernetes/klog#212, kubernetes/klog#432
Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant