feat(logging): enable NLog only in non-development environments

This commit is contained in:
tekh 2025-07-22 18:08:52 +02:00
parent 6ade388cd7
commit 5843e9efa8

View File

@ -10,9 +10,13 @@ try
{ {
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); builder.Logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
if (!builder.Environment.IsDevelopment())
{
builder.Logging.ClearProviders();
builder.Host.UseNLog(); builder.Host.UseNLog();
}
// Make sure to add the Ocelot configuration file // Make sure to add the Ocelot configuration file
var suffix = builder.Environment.IsDevelopment() ? ".Development" : ""; var suffix = builder.Environment.IsDevelopment() ? ".Development" : "";