Skip to content

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

Merged
richardcase merged 1 commit intoliquidmetal-dev:mainfrom
pierluigilenoci:fix/honor-stderrthreshold
May 5, 2026
Merged

fix: honor klog -stderrthreshold even when -logtostderr is true#353
richardcase merged 1 commit intoliquidmetal-dev:mainfrom
pierluigilenoci:fix/honor-stderrthreshold

Conversation

@pierluigilenoci
Copy link
Copy Markdown
Contributor

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 main.go so that -stderrthreshold is honored, while preserving the current default behavior (stderrthreshold=INFO means all logs still go to stderr unless the user explicitly overrides it on the command line).

References

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 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 <[email protected]>
@pierluigilenoci
Copy link
Copy Markdown
Contributor Author

Hi @richardcase — would you have a moment to review this PR? It fixes klog's -stderrthreshold flag being silently ignored when -logtostderr is set to true. Thanks!

@richardcase richardcase added the kind/bug Something isn't working label May 5, 2026
@richardcase richardcase merged commit 5d67c4a into liquidmetal-dev:main May 5, 2026
4 of 5 checks passed
@richardcase
Copy link
Copy Markdown
Member

@pierluigilenoci - all merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants