我具有以下appsettings配置,但没有看到正在生成的任何文件:
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning"
}
},
"WriteTo": [
{
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "CaseManagement1.log",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}
在Startup.cs中,ConfigureServices事件中包含以下内容:
[{Level:u3}] [{Properties}] {Message:lj}
{NewLine}{Exception}"
}
}
]
}
}
],
"Enrich": [ "FromLogContext"]
}
`
var configuration = new ConfigurationBuilder()
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
.Build();
services.AddScoped<Serilog.ILogger>
(x => new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger());
`
我正在运行以下内容:
谢谢