简体   繁体   中英

logging with Serilog Concurrently to AzureTableStorage

Logging to AzureTableStorage is causing an overhead that blocks next calls, compared to when logging into a file, is there a way to make this process faster (batch or async option)?

My code in appsetttings.josn:

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

I ended up using https://github.com/serilog/serilog-sinks-async and the batch option in AzureTableStorage, similar to:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM