使用Serilog同时登录到AzureTableStorage

时间:2018-06-18 13:31:29

标签: asp.net-core azure-table-storage serilog

登录到AzureTableStorage会导致阻止下一次调用的开销,与登录文件时相比,是否有办法使此过程更快(批处理或异步选项)?

appsetttings.josn中的代码:

"Serilog": {
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "AzureTableStorage",
        "Args": {
          "storageTableName": "tbl",
          "connectionString": "DefaultEndpointsProtocol=http;AccountName=xxx;AccountKey=/xxxxxxxx"
        }
      }
    ]
  }

1 个答案:

答案 0 :(得分:2)

我最终使用https://github.com/serilog/serilog-sinks-async和AzureTableStorage中的批处理选项,类似于:

"WriteTo": [
            {
                "Name": "Async",
                "Args": {
                    "configure": [
                        {
                            "Name": "AzureTableStorage",
                            "Args": {
                                "storageTableName": "tbl",
                                "connectionString": "DefaultEndpointsProtocol=http;AccountName=xxx;AccountKey=xxx"
                            }
                        }
                    ]
                }
            }
        ]