Skip to content

Zapr log levels don't align with glog/klog recommendations #3081

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

Open
alvaroaleman opened this issue Jan 20, 2025 · 3 comments
Open

Zapr log levels don't align with glog/klog recommendations #3081

alvaroaleman opened this issue Jan 20, 2025 · 3 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@alvaroaleman
Copy link
Member

The named debug log level of zap corresponds to the numeric value -1, which then gets inverted by zapr and thus corresponds toV(1). At the same time, the Kubernetes logging guidelines assume V(4) to be debug level and V(1) A reasonable default log level if you don't want verbosity: https://github.com/kubernetes/community/blob/905825353d20c57817806dd5aab242ea6c703024/contributors/devel/sig-instrumentation/logging.md#what-method-to-use

So the mapping between the two seems off, furthermore most users of zap are likely to not be aware that the log level is an int8 under the hood and can have values outside of the defined named set. We should find a way so that the named debug in zap corresponds to something resembling a debug log level in the glog/klog/logr universe.

@sbueringer
Copy link
Member

sbueringer commented Jan 20, 2025

Just want to mention that component-base uses zap for JSON logging under the hood (while they use klog for text). I didn't look up the details, but sounds like they are using zap in a way that the log levels are treated the same way between zap & klog.

(not saying that's the right "solution", just a data point)

component-base JSON zap implementation can be found here: https://github.com/kubernetes/component-base/blob/master/logs/json/json.go

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 20, 2025
@sbueringer
Copy link
Member

/remove-lifecycle stale
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

4 participants