File tree 3 files changed +5
-1
lines changed 3 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import (
13
13
"go.uber.org/zap"
14
14
"k8s.io/apimachinery/pkg/types"
15
15
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
16
+ "k8s.io/klog/v2"
16
17
"sigs.k8s.io/controller-runtime/pkg/log"
17
18
ctlrZap "sigs.k8s.io/controller-runtime/pkg/log/zap"
18
19
@@ -128,6 +129,8 @@ func createStaticModeCommand() *cobra.Command {
128
129
atom := zap .NewAtomicLevel ()
129
130
130
131
logger := ctlrZap .New (ctlrZap .Level (atom ))
132
+ klog .SetLogger (logger )
133
+
131
134
commit , date , dirty := getBuildInfo ()
132
135
logger .Info (
133
136
"Starting NGINX Gateway Fabric in static mode" ,
Original file line number Diff line number Diff line change @@ -383,6 +383,7 @@ There are two critical libraries for NGF that log:
383
383
of that project.
384
384
- [ client-go] ( https://github.com/kubernetes/client-go ) .
385
385
- It uses [ klog] ( https://github.com/kubernetes/klog ) for logging.
386
+ - We inject the above logger into klog to ensure it uses the same formatting.
386
387
- Most of the logging is done at increased klog-specific
387
388
verbosity. However, errors are logged at the default verbosity like
388
389
in [ this line] ( https://github.com/kubernetes/client-go/blob/c5b1c13ccbedeb03c00ba162ef27566b0dfb512d/tools/record/event.go#L240 ) .
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ require (
23
23
k8s.io/apiextensions-apiserver v0.31.1
24
24
k8s.io/apimachinery v0.31.1
25
25
k8s.io/client-go v0.31.1
26
+ k8s.io/klog/v2 v2.130.1
26
27
sigs.k8s.io/controller-runtime v0.19.0
27
28
sigs.k8s.io/gateway-api v1.1.0
28
29
)
@@ -89,7 +90,6 @@ require (
89
90
gopkg.in/inf.v0 v0.9.1 // indirect
90
91
gopkg.in/yaml.v2 v2.4.0 // indirect
91
92
gopkg.in/yaml.v3 v3.0.1 // indirect
92
- k8s.io/klog/v2 v2.130.1 // indirect
93
93
k8s.io/kube-openapi v0.0.0-20240423202451-8948a665c108 // indirect
94
94
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
95
95
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
You can’t perform that action at this time.
0 commit comments