diff --git a/veza-backend-api/internal/logging/logger.go b/veza-backend-api/internal/logging/logger.go index 351cbb897..32bbb4884 100644 --- a/veza-backend-api/internal/logging/logger.go +++ b/veza-backend-api/internal/logging/logger.go @@ -103,6 +103,17 @@ func NewLoggerWithRotation(env, logFile, logLevel string) (*Logger, error) { // En cas d'erreur de parsing, utiliser INFO par défaut level = zapcore.InfoLevel } + config.Level = zap.NewAtomicLevelAt(level) + + // FIX #28: Ajouter sampling en production/staging pour éviter spam + // Initial: log les 100 premiers messages par seconde + // Thereafter: log 1 message toutes les 100 messages suivants + if env == "production" || env == "staging" { + config.Sampling = &zap.SamplingConfig{ + Initial: 100, + Thereafter: 100, + } + } // Configuration de la rotation des logs avec lumberjack // Rotation par taille (100MB) et temps (daily)