-
Notifications
You must be signed in to change notification settings - Fork 220
Honor stderrthreshold when logtostderr is enabled #3611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,6 +54,12 @@ var exit = func(code int) { | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| func main() { | ||||||||||||||||||||||||||||||
| flag.Parse() | ||||||||||||||||||||||||||||||
| if err := flag.Set("legacy_stderr_threshold_behavior", "false"); err != nil { | ||||||||||||||||||||||||||||||
| klog.Errorf("Failed to set legacy_stderr_threshold_behavior: %v", err) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| if err := flag.Set("stderrthreshold", "INFO"); err != nil { | ||||||||||||||||||||||||||||||
| klog.Errorf("Failed to set stderrthreshold: %v", err) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
Comment on lines
56
to
+62
|
||||||||||||||||||||||||||||||
| flag.Parse() | |
| if err := flag.Set("legacy_stderr_threshold_behavior", "false"); err != nil { | |
| klog.Errorf("Failed to set legacy_stderr_threshold_behavior: %v", err) | |
| } | |
| if err := flag.Set("stderrthreshold", "INFO"); err != nil { | |
| klog.Errorf("Failed to set stderrthreshold: %v", err) | |
| } | |
| if err := flag.Set("legacy_stderr_threshold_behavior", "false"); err != nil { | |
| klog.Errorf("Failed to set legacy_stderr_threshold_behavior: %v", err) | |
| } | |
| if err := flag.Set("stderrthreshold", "INFO"); err != nil { | |
| klog.Errorf("Failed to set stderrthreshold: %v", err) | |
| } | |
| flag.Parse() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are existing tests for this package, but none currently validate the new CLI behavior around honoring
--stderrthresholdwhenlogtostderris enabled. Adding a unit test that setsos.Argswith an explicit--stderrthresholdvalue and asserts it is not overridden would help prevent regressions in this flag-handling logic.