Update logging configuration in Program.cs

Modified logging setup to use NLog only in non-development environments, while maintaining trace-level logging for development.
This commit is contained in:
Developer 02 2025-05-11 11:14:19 +02:00
parent a76afdda34
commit 941e47ba3e

View File

@ -10,9 +10,13 @@ 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" : "";