Skip to content

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

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

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

Conversation

@pierluigilenoci
Copy link
Copy Markdown

@pierluigilenoci pierluigilenoci commented Apr 23, 2026

What changed

klog v2 defaults -logtostderr to true, which silently ignores -stderrthreshold — all log levels go to stderr unconditionally. This has been an open issue since 2020.

klog v2.140.0 introduced a fix behind an opt-in flag (legacy_stderr_threshold_behavior). This PR bumps klog to v2.140.0 and enables the fix in both entry points (cmd/addon-manager/main.go and pkg/config/args_log.go) so that -stderrthreshold is honored, while preserving the current default behavior.

References


Summary by cubic

Honor -stderrthreshold even when -logtostderr is true by enabling klog’s new behavior. Default stderr logging stays at INFO unless the user changes it.

  • Bug Fixes

    • Set legacy_stderr_threshold_behavior=false and default stderrthreshold=INFO in cmd/addon-manager/main.go and pkg/config/args_log.go.
  • Dependencies

    • Bump k8s.io/klog/v2 to v2.140.0.

Written for commit 4b6d706. Summary will update on new commits.

klog v2 defaults -logtostderr to true, which silently ignores
-stderrthreshold — all log levels go to stderr unconditionally.
This has been an open issue since 2020 (kubernetes/klog#212).

klog v2.140.0 introduced a fix behind an opt-in flag
(legacy_stderr_threshold_behavior). This commit bumps klog to
v2.140.0 and enables the fix in both entry points so that
-stderrthreshold is honored, while preserving the current default
behavior (stderrthreshold=INFO means all logs still go to stderr
unless the user overrides it on the command line).

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 10.50%. Comparing base (2b04dd4) to head (4b6d706).

Files with missing lines Patch % Lines
pkg/config/args_log.go 0.00% 5 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #168      +/-   ##
==========================================
- Coverage   10.51%   10.50%   -0.01%     
==========================================
  Files          49       49              
  Lines        7029     7034       +5     
==========================================
  Hits          739      739              
- Misses       6238     6243       +5     
  Partials       52       52              
Flag Coverage Δ
unit-test 10.50% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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