Description
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.
Activity
sbueringer commentedon 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 commentedon Apr 20, 2025
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/remove-lifecycle stale/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
sbueringer commentedon May 8, 2025
/remove-lifecycle stale
/lifecycle frozen