Skip to content
Last update: May 8, 2024

How to update platform to Serilog integrated version

Note

Along with updating platform to 3.304.0 version you have to update xAPI module to version 3.314.0 or higher.

To update your platform version to 3.304.0 and higher, use one of the following options:

Option 1. Migrate existing configuration to Serilog format

If you commited changes to logging configuration:

  1. Map existing configuration into Serilog format in the appsettings.{ENVIRONMENT}.json Logging section.
  2. Replace the original configuration with the Serilog configuration.

Below are examples of the appsettings.{ENVIRONMENT}.json file before and after migration:

Before:

appsettings.{ENVIRONMENT}.json
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  }
}

After:

appsettings.{ENVIRONMENT}.json
{
  "Serilog": {
  "Using": [
      "Serilog.Sinks.Console"
    ],
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Warning",
        "System": "Warning"
      }
    },
    "WriteTo": [
      {
        "Name": "Console"        
      }
    ]
  }
}

Readmore Serilog Settings Configuration

Option 2. Use Application Insights

Since Application Insights integration was moved to a separate module:

  1. Download it manually or install it via vc-build CLI .

  2. Add the following changes to the appsettings.{ENVIRONMENT}.json file.

appsettings.{ENVIRONMENT}.json
{
  "Serilog": {
    "Using": [
      "Serilog.Sinks.ApplicationInsights"
    ],
    "WriteTo": [
      {
        "Name": "ApplicationInsights",
        "Args": {
          "connectionString": "<Copy connection string from Application Insights Resource Overview>",
          "telemetryConverter": "Serilog.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights",
          "restrictedToMinimumLevel": "Error"
        }
      }
    ]
  }
}