修改日志框架
This commit is contained in:
1 parent
f1fa0401c2
commit
fdc9b9e36d
11 files changed
+230
-175
No files matched your search
@@ -0,0 +1,141 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.Console",
|
||||
"Serilog.Sinks.File",
|
||||
"Serilog.Filters.Expressions"
|
||||
],
|
||||
"MinimumLevel": {
|
||||
"Default": "Debug",
|
||||
"Override": {
|
||||
"Microsoft": "Information",
|
||||
"Microsoft.AspNetCore": "Warning",
|
||||
"System": "Warning",
|
||||
"Hangfire": "Information"
|
||||
}
|
||||
},
|
||||
"Enrich": [
|
||||
"FromLogContext"
|
||||
],
|
||||
"Properties": {
|
||||
"Application": "MyAspNetCore"
|
||||
},
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Logger",
|
||||
"Args": {
|
||||
"configureLogger": {
|
||||
"Filter": [
|
||||
{ "Name": "ByIncludingOnly", "Args": { "expression": "@Level = 'Debug'" } }
|
||||
],
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/Debug/.log",
|
||||
"rollingInterval": "Day",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
|
||||
"retainedFileCountLimit": 365,
|
||||
"fileSizeLimitBytes": 104857600,
|
||||
"rollOnFileSizeLimit": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Logger",
|
||||
"Args": {
|
||||
"configureLogger": {
|
||||
"Filter": [
|
||||
{ "Name": "ByIncludingOnly", "Args": { "expression": "@Level = 'Information'" } }
|
||||
],
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/Info/.log",
|
||||
"rollingInterval": "Day",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
|
||||
"retainedFileCountLimit": 365,
|
||||
"fileSizeLimitBytes": 104857600,
|
||||
"rollOnFileSizeLimit": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Logger",
|
||||
"Args": {
|
||||
"configureLogger": {
|
||||
"Filter": [
|
||||
{ "Name": "ByIncludingOnly", "Args": { "expression": "@Level = 'Warning'" } }
|
||||
],
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/Warning/.log",
|
||||
"rollingInterval": "Day",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
|
||||
"retainedFileCountLimit": 365,
|
||||
"fileSizeLimitBytes": 104857600,
|
||||
"rollOnFileSizeLimit": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Logger",
|
||||
"Args": {
|
||||
"configureLogger": {
|
||||
"Filter": [
|
||||
{ "Name": "ByIncludingOnly", "Args": { "expression": "@Level = 'Error'" } }
|
||||
],
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/Error/.log",
|
||||
"rollingInterval": "Day",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
|
||||
"retainedFileCountLimit": 365,
|
||||
"fileSizeLimitBytes": 104857600,
|
||||
"rollOnFileSizeLimit": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Logger",
|
||||
"Args": {
|
||||
"configureLogger": {
|
||||
"Filter": [
|
||||
{ "Name": "ByIncludingOnly", "Args": { "expression": "@Level = 'Fatal'" } }
|
||||
],
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Logs/Fatal/.log",
|
||||
"rollingInterval": "Day",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
|
||||
"retainedFileCountLimit": 365,
|
||||
"fileSizeLimitBytes": 104857600,
|
||||
"rollOnFileSizeLimit": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user