Skip to content

Commit 5891ae9

Browse files
authored
Ensure client-go-originating logs are consistent with zap logger (#983)
1 parent 9197655 commit 5891ae9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package main
1111
import (
1212
"flag"
1313
"fmt"
14+
"k8s.io/klog/v2"
1415
"os"
1516
"strconv"
1617
"time"
@@ -57,7 +58,10 @@ func main() {
5758

5859
flag.Parse()
5960

60-
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
61+
logger := zap.New(zap.UseFlagOptions(&opts))
62+
ctrl.SetLogger(logger)
63+
// https://github.com/kubernetes-sigs/controller-runtime/issues/1420#issuecomment-794525248
64+
klog.SetLogger(logger.WithName("rabbitmq-cluster-operator"))
6165

6266
operatorNamespace := os.Getenv("OPERATOR_NAMESPACE")
6367
if operatorNamespace == "" {

0 commit comments

Comments
 (0)