diff --git a/internal/framework/events/loop.go b/internal/framework/events/loop.go index 1afe5307d3..25272a4278 100644 --- a/internal/framework/events/loop.go +++ b/internal/framework/events/loop.go @@ -69,11 +69,11 @@ func (el *EventLoop) Start(ctx context.Context) error { el.currentBatchID++ batchLogger := el.logger.WithName("eventHandler").WithValues("batchID", el.currentBatchID) - batchLogger.Info("Handling events from the batch", "total", len(batch)) + batchLogger.V(1).Info("Handling events from the batch", "total", len(batch)) el.handler.HandleEventBatch(ctx, batchLogger, batch) - batchLogger.Info("Finished handling the batch") + batchLogger.V(1).Info("Finished handling the batch") handlingDone <- struct{}{} }(el.currentBatch) } @@ -120,7 +120,7 @@ func (el *EventLoop) Start(ctx context.Context) error { // Add the event to the current batch. el.nextBatch = append(el.nextBatch, e) - el.logger.Info( + el.logger.V(1).Info( "added an event to the next batch", "type", fmt.Sprintf("%T", e), "total", len(el.nextBatch), diff --git a/internal/mode/static/manager.go b/internal/mode/static/manager.go index e4efc25bcd..7f58febaf9 100644 --- a/internal/mode/static/manager.go +++ b/internal/mode/static/manager.go @@ -282,6 +282,11 @@ func StartManager(cfg config.Config) error { } cfg.Logger.Info("Starting manager") + go func() { + <-ctx.Done() + cfg.Logger.Info("Shutting down") + }() + return mgr.Start(ctx) } @@ -306,7 +311,7 @@ func createPolicyManager( func createManager(cfg config.Config, nginxChecker *nginxConfiguredOnStartChecker) (manager.Manager, error) { options := manager.Options{ Scheme: scheme, - Logger: cfg.Logger, + Logger: cfg.Logger.V(1), Metrics: getMetricsOptions(cfg.MetricsConfig), // Note: when the leadership is lost, the manager will return an error in the Start() method. // However, it will not wait for any Runnable it starts to finish, meaning any in-progress operations diff --git a/internal/mode/static/nginx/file/manager.go b/internal/mode/static/nginx/file/manager.go index 784273d110..b2726c5b54 100644 --- a/internal/mode/static/nginx/file/manager.go +++ b/internal/mode/static/nginx/file/manager.go @@ -103,7 +103,7 @@ func (m *ManagerImpl) ReplaceFiles(files []File) error { return fmt.Errorf("failed to delete file %q: %w", path, err) } - m.logger.Info("Deleted file", "path", path) + m.logger.V(1).Info("Deleted file", "path", path) } // In some cases, NGINX reads files in runtime, like a JWK. If you remove such file, NGINX will fail @@ -118,7 +118,7 @@ func (m *ManagerImpl) ReplaceFiles(files []File) error { } m.lastWrittenPaths = append(m.lastWrittenPaths, file.Path) - m.logger.Info("Wrote file", "path", file.Path) + m.logger.V(1).Info("Wrote file", "path", file.Path) } return nil diff --git a/tests/framework/ngf.go b/tests/framework/ngf.go index 48863a23e7..7708172696 100644 --- a/tests/framework/ngf.go +++ b/tests/framework/ngf.go @@ -67,6 +67,7 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { "--namespace", cfg.Namespace, "--wait", "--set", "nginxGateway.productTelemetry.enable=false", + "--set", "nginxGateway.config.logging.level=debug", } if cfg.ChartVersion != "" { args = append(args, "--version", cfg.ChartVersion) @@ -95,6 +96,7 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) { "--namespace", cfg.Namespace, "--wait", "--set", "nginxGateway.productTelemetry.enable=false", + "--set", "nginxGateway.config.logging.level=debug", } if cfg.ChartVersion != "" { args = append(args, "--version", cfg.ChartVersion)