Skip to content
Last update: February 1, 2024


VC Platform supports two logging libraries out of the box:


Starting from version 3.304.0 we are transitioning to Serliog library for leverage more advanced logging capabilities like structured data, storing log events in various formats, data enrichment option, etc. As part of this transition, Azure Application Insights has been moved to a dedicated Virto Commerce module, offering even more flexibility and control over your logging and telemetry.

Basic scenarios

Here are basic usage scenarios how to use platform logging.

Configuring logging

Logging configuration is provided by the Serilog section of appsettings.{ENVIRONMENT}.json files, where the {ENVIRONMENT} placeholder is the environment.

Here is an example of Serilog configuration. In this file we use two sinks (Console and Debug) for writing logs, and also define default severity level for lg.

  "Serilog": {
    "Using": [
    "MinimumLevel": {
      "Default": "Error",
      "Override": {
        "Microsoft.AspNetCore": "Information"        
    "WriteTo": [

In this example:

  • The two sinks (Console and Debug) are used to writing logs.
  • The log level Error is set as default. That means, all logs messages with log level Error or higher will be logged, all other logs with log level lower than Error like Information, Trace, Debug will be skipped.
  • The Microsoft.AspNetCore category applies to all categories that start with Microsoft.AspNetCore. For example, this setting applies to the Microsoft.AspNetCore.Routing.EndpointMiddleware category.
  • The Microsoft.AspNetCore category logs at log level Information and higher.

See more configuration examples

Writing Log Events

Log events are written to sinks using the Log static class, or the methods on an ILogger:

Log.Warning("Disk quota {Quota} MB exceeded by {User}", quota, user);

The same example using ILogging interface:

ILogger logger;
logger.LogWarning("Disk quota {Quota} MB exceeded by {User}", quota, user);


Next steps: