如何通过.NET Core 3中的命令行参数设置日志级别

时间:2019-10-14 09:02:47

标签: .net-core-logging .net-core-configuration

我有一个.NET Core 3.0控制台应用程序。我有一个Microsoft.Extensions.Logging记录器,正在使用命令行参数构建Microsoft.Extensions.Configuration。

我的问题是“如何通过命令行参数设置日志级别?”

1 个答案:

答案 0 :(得分:0)

正如Configuration in ASP.NET Core文档中指出的那样,可以通过以下方式之一传递参数:

cache=TRUE

示例:

No prefix   CommandLineKey1=value1
Two dashes  --CommandLineKey2=value2, --CommandLineKey2 value2
Slash (/)   /CommandLineKey3=value3,  /CommandLineKey3 value3