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
Need to improve the readability of the log #14
Comments
/kind cleanup |
much agree, klog is soo much better |
/assign |
Let's reach to some level of agreement before we jump into implementing :) If this is juts about format, I believe there are different zap configurations we can use. This is actually my first time using zap, so I'm not really sure what's possible. While klog format might be better, the framework doesn't currently support contextual logging, which simplifies building structured logging a lot. In the meantime, if we stick with logr for now, I think it will be easier to switch to klog (v3?) once it supports contextual logging. |
let's defer this to klog/v3 but keep circling back here. I am a klog fan for sure |
is there a better format we can use for zap? |
This is why I don't like logr 1.6454820377420967e+09 ERROR job-reconciler Unsuspending job {"job": {"name":"sample-job","namespace":"default"}, "error": "Operation cannot be fulfilled on jobs.batch \"sample-jo
b\": the object has been modified; please apply your changes to the latest version and try again"} sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:114
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:311
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:227
1.6454820377421455e+09 ERROR controller.job Reconciler error {"reconciler group": "batch", "reconciler kind": "Job", "name": "sample-job", "namespace": "default", "error": "Operat
ion cannot be fulfilled on jobs.batch \"sample-job\": the object has been modified; please apply your changes to the latest version and try again"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:227 had the similar erro/logs on NFD when using logr, and got rid by moving to klog/v2 |
Can you try to migrate to https://github.com/kubernetes/klog/tree/main/klogr? |
I'm fine waiting for v3 or replacing zapper with klogr. I don't want to loose contextual logging. |
Since we are on a hold here |
You could always give klogr a try |
/kind cleanup |
What is the status of this? |
I disabled the dev mode for the binary, so the output is all structured now:
It looks like klog made progress towards contextual logging https://github.com/kubernetes/klog/blob/main/contextual.go Let me ask what's the status of it. |
Documentation is up here: Kueue using it will help it mature. /help |
@alculquicondor: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/help |
/remove-lifecycle stale |
I just realized that kubernetes uses zap to do json output through klog. klog's contextual logging implements the logr.Logger interface. So it doesn't look like we benefit much migrating to klog, given that controller-runtime already expects a Logger. However, there are some logs for which we are receiving the wrong call reference. I'll see if there is something we can do kubernetes-sigs/controller-runtime#1737 |
I managed to fix it, but we'll have to leave this until there's a controller-runtime release kubernetes-sigs/controller-runtime#1975 |
/help cancel |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/lifecycle stale We should be able to upgrade controller-runtime to have the fix /help |
I'll take a look at this. /assign @kannon92 |
We can chose to switch to klog/v2.
The text was updated successfully, but these errors were encountered: