csi-addons / volume-replication-operator

Apache License 2.0
16 stars 23 forks source link

replication: skip stacktrace by default #105

Closed Madhu-1 closed 3 years ago

Madhu-1 commented 3 years ago

skipping the stack trace while logging by default and add configuration to print the timestamp in logging.

Signed-off-by: Madhu Rajanna madhupr007@gmail.com

Before logging

{"level":"error","ts":1629187039.095559,"logger":"controller-runtime.manager.controller.volumereplication","caller":"controller/controller.go:235","msg":"Reconciler error","reconciler group":"replication.storage.openshift.io","reconciler kind":"VolumeReplication","name":"pvc-volumereplication-ss","namespace":"default","error":"VolumeReplicationClass.replication.storage.openshift.io \"rbd-volumereplicationclass\" not found","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/go/pkg/mod/github.com/go-logr/zapr@v0.2.0/zapr.go:132\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.7.0/pkg/internal/controller/controller.go:267\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.7.0/pkg/internal/controller/controller.go:235\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.1\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.7.0/pkg/internal/controller/controller.go:198\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1\n\t/go/pkg/mod/k8s.io/apimachinery@v0.19.2/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1\n\t/go/pkg/mod/k8s.io/apimachinery@v0.19.2/pkg/util/wait/wait.go:155\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil\n\t/go/pkg/mod/k8s.io/apimachinery@v0.19.2/pkg/util/wait/wait.go:156\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/go/pkg/mod/k8s.io/apimachinery@v0.19.2/pkg/util/wait/wait.go:133\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext\n\t/go/pkg/mod/k8s.io/apimachinery@v0.19.2/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.UntilWithContext\n\t/go/pkg/mod/k8s.io/apimachinery@v0.19.2/pkg/util/wait/wait.go:99"

After

{"level":"error","timestamp":"2021-08-17T11:31:19.133Z","logger":"controllers.VolumeReplication","caller":"controller/controller.go:263","msg":"failed to get PVC","Request.Name":"pvc-volumereplication-ss","Request.Namespace":"default","PVCName":"rbd-pvc","error":"PersistentVolumeClaim \"rbd-pvc\" not found"} {"level":"error","timestamp":"2021-08-17T11:31:19.137Z","logger":"controller-runtime.manager.controller.volumereplication","caller":"controller/controller.go:235","msg":"Reconciler error","reconciler group":"replication.storage.openshift.io","reconciler kind":"VolumeReplication","name":"pvc-volumereplication-ss","namespace":"default","error":"PersistentVolumeClaim \"rbd-pvc\" not found"}

sp98 commented 3 years ago

Won't this be useful while debugging? Suggestion to make it configurable some how. Always on in dev mod and off in production mode.

Madhu-1 commented 3 years ago

this will hurt a lot when debugging in the production logs (this also increases the number of logs for each failure), If we log the things properly we don't need stack trace at least in production.

Madhu-1 commented 3 years ago

Won't this be useful while debugging? Suggestion to make it configurable some how. Always on in dev mod and off in production mode.

stack tracing will be on in DEV mode but it will be off by default