From 5843e9efa8c6677daa29ee086f3de5bda378754e Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 22 Jul 2025 18:08:52 +0200 Subject: [PATCH] feat(logging): enable NLog only in non-development environments --- Program.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index a527042..391d106 100644 --- a/Program.cs +++ b/Program.cs @@ -9,10 +9,14 @@ logger.Info("Logging initialized."); try { var builder = WebApplication.CreateBuilder(args); - - builder.Logging.ClearProviders(); + builder.Logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); - builder.Host.UseNLog(); + + if (!builder.Environment.IsDevelopment()) + { + builder.Logging.ClearProviders(); + builder.Host.UseNLog(); + } // Make sure to add the Ocelot configuration file var suffix = builder.Environment.IsDevelopment() ? ".Development" : "";