.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" }
}
}
}
]
}

posted @ 2019-07-26 10:59  lovewl  阅读(903)  评论(0编辑  收藏  举报