.net core appsettings 配置 serilog

"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Fatal",
"System": "Fatal"
}
},
"WriteTo": [
{
"Name": "RollingFile",
"Args": {
"pathFormat": "logs/{Date}.log",
"outputTemplate": "{Timestamp:HH:mm:ss} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
"shared": true,
"restrictedToMinimumLevel": "Debug"
}
},
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "server=.;database=Qujiang_201905301637;uid=qujiang1;pwd=qujiang1;",
"tableName": "SeriLogs",
"autoCreateSqlTable": true,
"restrictedToMinimumLevel": "Warning",
"batchPostingLimit": 1000,
"columnOptionsSection": {
//"disableTriggers": true,
//"clusteredColumnstoreIndex": false,
//"primaryKeyColumnName": "Id",
//"addStandardColumns": [ "LogEvent" ],
"removeStandardColumns": [ "MessageTemplate", "Properties" ],
//"additionalColumns": [
// {
// "ColumnName": "EventType",
// "DataType": "int",
// "AllowNull": false
// },
// {
// "ColumnName": "Release",
// "DataType": "varchar",
// "DataLength": 32
// },
// {
// "ColumnName": "All_SqlColumn_Defaults",
// "DataType": "varchar",
// "AllowNull": true,
// "DataLength": -1,
// "NonClusteredIndex": false
// }
//],
"id": { "nonClusteredIndex": true },
"level": {
"columnName": "Severity",
"storeAsEnum": false
},
//"properties": {
// "columnName": "Properties",
// "excludeAdditionalProperties": true,
// "dictionaryElementName": "dict",
// "itemElementName": "item",
// "omitDictionaryContainerElement": false,
// "omitSequenceContainerElement": false,
// "omitStructureContainerElement": false,
// "omitElementIfEmpty": true,
// "propertyElementName": "prop",
// "rootElementName": "root",
// "sequenceElementName": "seq",
// "structureElementName": "struct",
// "usePropertyKeyAsElementName": false
//},
//"timeStamp": {
// "columnName": "Timestamp",
// "convertToUtc": true
//},
//"logEvent": {
// "excludeAdditionalProperties": true,
// "excludeStandardColumns": true
//},
"message": { "columnName": "Msg" },
"exception": { "columnName": "Ex" },
"messageTemplate": { "columnName": "Template" }
}
}
}
]
}

转载于:https://www.cnblogs.com/lovewl2/p/11248949.html

你可能感兴趣的:(.net core appsettings 配置 serilog)