我可以连接到新表日志 serilog 吗?

问题描述 投票:0回答:0

我已经在使用 serilog 的 .net 核心应用程序中连接了一个表(logs1)。但是我无法通过更改 appsettings 中的名称来创建新表。

当我手动删除表时,在 appsettings 中使用新名称(logs2)运行应用程序,日志仅记录在 logs1 中

"Serilog": {
    "MinimumLevel": {
      "Default": "Warning",
      "Override": {
        "Microsoft": "Warning",
        "System": "Warning",
        "Microsoft.Hosting.Lifetime": "Warning"
      }
    },
    "WriteTo": [
      {
        "Name": "MSSqlServer",
        "Args": {
          "connectionString": "***********;Initial Catalog=ewaybill_auth;User ID=sa;Password=nic@1234; MultipleActiveResultSets=true",
          "tableName": "Logs2",
          "autoCreateSqlTable": true,
          "columnOptionsSection": {
            "customColumns": [
              {
                "ColumnName": "ErrorCode",
                "DataType": "varchar",
                "AllowNull": true,
                "DataLength": 50
              },
              {
                "ColumnName": "ReqId",
                "DataType": "bigint",
                "AllowNull": true
              }
            ],
            "disableTriggers": true,
            "clusteredColumnstoreIndex": false,
            "primaryKeyColumnName": "Id",
            "id": { "nonClusteredIndex": true }
          }
        }
      }

我已经在使用 serilog 的 .net 核心应用程序中连接了一个表(logs1)。但是我无法通过更改 appsettings 中的名称来创建新表。

当我手动删除表时,在 appsettings 中使用新名称(logs2)运行应用程序,日志仅记录在 logs1 中

c# .net .net-core logging serilog
© www.soinside.com 2019 - 2024. All rights reserved.