这是我的配置文件:
{
"Logging": {
"LogLevel": {
"Console": "Critical",
"Default": "Warning",
"System": "Warning",
"Microsoft": "Trace"
}
}
}
我用这个代码加载配置文件:
hostBuilder.ConfigureLogging ( ( context, builder ) =>
{
builder.AddConfiguration ( context.Configuration.GetSection ( "Logging" ) );
builder.AddConsole ( );
} );
但它为类别设置了Information
日志级别:System
,Microsoft
和Debug
的Default
。我在哪里弄错了?
我发现了一个错误。有两个配置文件appsettings.json和appsettings.Development.json。系统在开发模式下使用它。