fix: honor -stderrthreshold even when -logtostderr is true#2017
Open
pierluigilenoci wants to merge 2 commits intoAzure:masterfrom
Open
fix: honor -stderrthreshold even when -logtostderr is true#2017pierluigilenoci wants to merge 2 commits intoAzure:masterfrom
pierluigilenoci wants to merge 2 commits intoAzure:masterfrom
Conversation
klog v2 defaults -logtostderr to true, which silently causes -stderrthreshold to be ignored. klog v2.140.0 introduced the legacy_stderr_threshold_behavior flag to opt into corrected behavior (kubernetes/klog#212, kubernetes/klog#432). Set legacy_stderr_threshold_behavior=false and stderrthreshold=INFO after klog.InitFlags so operators can control log routing via -stderrthreshold as expected. Also bumps k8s.io/klog/v2 from v2.130.1 to v2.140.0. Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com> Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
Contributor
Author
|
Hi — friendly ping. Is this PR still on the radar for review? Happy to rebase or make changes if needed. Thanks! |
Contributor
Author
|
@aramase — fun fact: this PR finally fixes #387 which was opened 5 years ago! Back then you mentioned that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
klog v2 defaults
-logtostderrtotrue, which silently causes-stderrthresholdto be ignored. This means operators cannot control log severity routing via-stderrthresholdas the flag documentation implies.klog v2.140.0 introduced the
legacy_stderr_threshold_behaviorflag to opt into the corrected behavior (see kubernetes/klog#212, kubernetes/klog#432).This PR:
k8s.io/klog/v2from v2.130.1 to v2.140.0legacy_stderr_threshold_behavior=falseandstderrthreshold=INFOafterklog.InitFlags(nil)and beforeflag.Parse(), so that-stderrthresholdis honored as expectedWhich issue(s) this PR fixes
Fixes the silent interaction between
-logtostderr(defaulttrue) and-stderrthresholddocumented in kubernetes/klog#212.Testing
go build ./...passes-stderrthreshold(INFO is the default)-stderrthreshold=WARNING(or higher) will now correctly see only warnings and above on stderr