Skip to content

Commit a0178b7

Browse files
authored
Merge pull request #6471 from jabellard/cm-json-log2
`karmada-controller-manager`: Add controller-runtime logs back
2 parents 571801f + f804e73 commit a0178b7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/controller-manager/app/controllermanager.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
127127
return err
128128
}
129129
logs.InitLogs()
130+
131+
// Starting from version 0.15.0, controller-runtime expects its consumers to set a logger through log.SetLogger.
132+
// If SetLogger is not called within the first 30 seconds of a binaries lifetime, it will get
133+
// set to a NullLogSink and report an error. Here's to silence the "log.SetLogger(...) was never called; logs will not be displayed" error
134+
// by setting a logger through log.SetLogger.
135+
// More info refer to: https://github.com/karmada-io/karmada/pull/4885.
136+
controllerruntime.SetLogger(klog.Background())
130137
return nil
131138
},
132139

0 commit comments

Comments
 (0)