Enhance logging configuration in Program.cs

Initialized logging by clearing providers, setting minimum
level to Trace, and configuring NLog as the logging provider.
This commit is contained in:
Developer 02 2025-05-09 23:20:27 +02:00
parent 23e73aae19
commit 6ade388cd7

View File

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