diff --git a/catalogd/cmd/catalogd/main.go b/catalogd/cmd/catalogd/main.go index f05f440a7..cd81b3668 100644 --- a/catalogd/cmd/catalogd/main.go +++ b/catalogd/cmd/catalogd/main.go @@ -146,6 +146,7 @@ func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) utilruntime.Must(catalogdv1.AddToScheme(scheme)) + ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig())) } func main() { @@ -189,7 +190,6 @@ func validateConfig(cfg *config) error { } func run(ctx context.Context) error { - ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig())) if klog.V(4).Enabled() { logrus.SetLevel(logrus.DebugLevel) } diff --git a/cmd/operator-controller/main.go b/cmd/operator-controller/main.go index 20bbcbc23..2a46afc6d 100644 --- a/cmd/operator-controller/main.go +++ b/cmd/operator-controller/main.go @@ -147,15 +147,14 @@ func init() { operatorControllerCmd.AddCommand(versionCommand) klog.InitFlags(flag.CommandLine) - if klog.V(4).Enabled() { - logrus.SetLevel(logrus.DebugLevel) - } //add klog flags to flagset flags.AddGoFlagSet(flag.CommandLine) //add feature gate flags to flagset features.OperatorControllerFeatureGate.AddFlag(flags) + + ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig())) } func validateMetricsFlags() error { if (cfg.certFile != "" && cfg.keyFile == "") || (cfg.certFile == "" && cfg.keyFile != "") { @@ -178,7 +177,9 @@ func validateMetricsFlags() error { return nil } func run() error { - ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig())) + if klog.V(4).Enabled() { + logrus.SetLevel(logrus.DebugLevel) + } setupLog.Info("starting up the controller", "version info", version.String())