diff --git a/src/Managing.Api/Program.cs b/src/Managing.Api/Program.cs index a90d153d..ad0bbc0c 100644 --- a/src/Managing.Api/Program.cs +++ b/src/Managing.Api/Program.cs @@ -132,18 +132,8 @@ builder.Services.AddDbContext((serviceProvider, options) => // Enable service provider caching for better performance options.EnableServiceProviderCaching(); - // Enable SQL query logging for warnings and errors only (reduced logging) - var logger = serviceProvider.GetRequiredService>(); - var sentryMonitoringService = serviceProvider.GetRequiredService(); - - options.LogTo(msg => - { - // Log only warnings and errors to reduce log volume - if (msg.Contains("Warning") || msg.Contains("Error")) - { - Console.WriteLine($"[EF-WARNING] {msg}"); - } - }, LogLevel.Warning); // Log only warnings and errors to reduce SQL log volume + // Disable SQL query logging to reduce log volume (only errors will be logged via standard logging) + // SQL monitoring is handled by SentrySqlMonitoringService which respects LogSlowQueriesOnly setting }, ServiceLifetime.Scoped); // Explicitly specify scoped lifetime for proper request isolation // Add specific health checks for databases and other services @@ -177,6 +167,7 @@ builder.Host.UseSerilog((hostBuilder, loggerConfiguration) => }; loggerConfiguration + .MinimumLevel.Override("Microsoft.EntityFrameworkCore.Database.Command", LogEventLevel.Warning) // Filter out EF Core SQL query logs .WriteTo.Console() .WriteTo.Elasticsearch(es); });