Skip to content

Honor stderrthreshold when logtostderr is enabled#428

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

Honor stderrthreshold when logtostderr is enabled#428
pierluigilenoci wants to merge 1 commit intokubernetes-sigs:masterfrom
pierluigilenoci:fix/honor-stderrthreshold

Conversation

@pierluigilenoci
Copy link
Copy Markdown
Member

What

Bump k8s.io/klog/v2 to v2.140.0 and opt out of the legacy stderr threshold behavior so that -stderrthreshold is respected even when -logtostderr=true (the klog v2 default).

Why

klog v2 defaults -logtostderr to true, which silently ignores -stderrthreshold. All log levels are unconditionally sent to stderr, making severity-based filtering impossible for log aggregation systems.

This was reported in kubernetes/klog#212 and fixed upstream in kubernetes/klog#432.

How

  • Set legacy_stderr_threshold_behavior=false after flag.Set("logtostderr", ...) in hack/smoketest.go to opt into the corrected behavior
  • Set stderrthreshold=INFO as default to preserve current behavior (all logs still go to stderr)
  • Users can now override via -stderrthreshold=WARNING or -stderrthreshold=ERROR

Bump k8s.io/klog/v2 to v2.140.0 and opt out of the legacy stderr
threshold behavior so that -stderrthreshold is respected even when
-logtostderr=true (the default).  Set stderrthreshold=INFO to preserve
current behavior; users can now override it on the command line.

Ref: kubernetes/klog#212, kubernetes/klog#432
Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pierluigilenoci
Once this PR has been reviewed and has the lgtm label, please assign atoato88 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants