Restrict NLog setup to non-dev; set log level to Trace
NLog provider setup and clearing of logging providers now occur only outside development environments. The minimum logging level is explicitly set to Trace for all environments.
This commit is contained in:
@@ -23,11 +23,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);
|
||||||
builder.Host.UseNLog();
|
|
||||||
|
|
||||||
builder.Configuration.AddJsonFile("consumer-repository.json", true, true);
|
if (!builder.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
builder.Logging.ClearProviders();
|
||||||
|
builder.Host.UseNLog();
|
||||||
|
}
|
||||||
|
|
||||||
builder.Configuration.AddJsonFile("consumer-repository.json", true, true);
|
builder.Configuration.AddJsonFile("consumer-repository.json", true, true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user