首页 新闻 搜索 专区 学院

NetCore|Serilog|AppSettings无法分级书写日志

0
[已解决问题] 解决于 2022-03-09 14:56


{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"Enrich": [ "FromLogContext", "WithThreadId" ],
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {SourceContext} {ThreadId} [{Level:u3}] {Message:lj}{NewLine}{Exception}"
}
},
{
"Name": "Error",
"Args": {
"path": "./Logs/Error/log.txt",
"formatter": "Serilog.Formatting.Compact.CompactJsonFormatter",
"rollingInterval": "Day",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {SourceContext} {ThreadId} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
"shared": true,
"rollOnFileSizeLimit": true,
"fileSizeLimitBytes": 102400000,
"retainedFileCountLimit": 365
}
},
{
"Name": "File",
"Args": {
"path": "./Logs/Info/log.txt",
"formatter": "Serilog.Formatting.Compact.CompactJsonFormatter",
"rollingInterval": "Day",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {SourceContext} {ThreadId} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
"shared": true,
"rollOnFileSizeLimit": true,
"fileSizeLimitBytes": 102400000,
"retainedFileCountLimit": 365
}
}
]
}
}


有没有大佬麻烦看下为什么不产生Error文件夹的日志,只有Info的呢,感谢感谢

< >
分享
最佳答案
0
奖励园豆:5
智客工坊 | 小虾三级 |园豆:1265 | 2022-03-09 09:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册