Skip to content

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

Merged
coldzerofear merged 1 commit intocoldzerofear:mainfrom
pierluigilenoci:fix/honor-stderrthreshold
Apr 24, 2026
Merged

fix: honor klog -stderrthreshold even when -logtostderr is true#45
coldzerofear merged 1 commit intocoldzerofear: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 all 4 command entry points (device-scheduler, device-monitor, device-webhook, device-plugin) so that -stderrthreshold is honored, while preserving the current default behavior.

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 in all 4 command entry points
(device-scheduler, device-monitor, device-webhook, device-plugin)
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>
@coldzerofear
Copy link
Copy Markdown
Owner

Thanks for the contribution

@coldzerofear coldzerofear merged commit fb25b57 into coldzerofear:main Apr 24, 2026
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