Configure logging for non-development environments
Conditionally clear logging providers and set up NLog only when the application is not in the development environment. This change improves logging management based on the environment, enhancing production logging behavior.
This commit is contained in:
parent
09df86000b
commit
040cf8641d
@ -26,9 +26,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();
|
||||
}
|
||||
|
||||
var config = builder.Configuration;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user