Skip to content

Honor stderrthreshold when logtostderr is enabled#3859

Open
pierluigilenoci wants to merge 3 commits intogoogle:masterfrom
pierluigilenoci:fix/honor-stderrthreshold
Open

Honor stderrthreshold when logtostderr is enabled#3859
pierluigilenoci wants to merge 3 commits intogoogle:masterfrom
pierluigilenoci:fix/honor-stderrthreshold

Conversation

@pierluigilenoci
Copy link
Copy Markdown

Summary

Opt into the new klog behavior so that -stderrthreshold is honored even when -logtostderr=true (the default). Set stderrthreshold=INFO to preserve backward compatibility.

Background

When -logtostderr=true, -stderrthreshold was ignored -- all logs went to stderr. Fixed in kubernetes/klog#432 (v2.140.0+), but projects must opt in.

Changes

  • Added flag.Set("legacy_stderr_threshold_behavior", "false") and flag.Set("stderrthreshold", "INFO") after every klog.InitFlags() call (7 call sites)
  • Bumped k8s.io/klog/v2 from v2.130.1 to v2.140.0
  • Added missing "flag" import where needed

References

Opt into the fixed klog behavior by setting legacy_stderr_threshold_behavior=false
after klog.InitFlags(). Ref: kubernetes/klog#212, kubernetes/klog#432

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 26, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@pierluigilenoci
Copy link
Copy Markdown
Author

Hi @vmarmol, @dashpole, @rjnagal -- would you be willing to review? Thank you!

@pierluigilenoci
Copy link
Copy Markdown
Author

@googlebot I signed it.

1 similar comment
@pierluigilenoci
Copy link
Copy Markdown
Author

@googlebot I signed it.

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
Update klog dependency in cmd/go.mod to match root module.

Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
@pierluigilenoci
Copy link
Copy Markdown
Author

Hi @vmarmol @dashpole @rjnagal — friendly follow-up. The CLA check is passing. This is a small change to opt into the fixed klog stderrthreshold behavior.

Would you be able to review when you get a chance? Thank you!

@dashpole
Copy link
Copy Markdown
Collaborator

I don't work on cAdvisor anymore.

@pierluigilenoci
Copy link
Copy Markdown
Author

Thank you for letting me know, @dashpole! Could @vmarmol or @rjnagal point me to the right person to review this? I see @thaJeztah and @olyazavr have been active recently — would either of you be able to take a look? It's a small klog stderrthreshold fix. Thank you!

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.

2 participants