# No logs are written

If the path to the log files is missing or refers to the wrong location, no log files will be created at the expected location. If the minimum level is also set too high, log entries on a lower level are not logged in this log file.

# Solution

If no log files are written, make sure that the log path in the appsettings.json file is set correctly in the Serilog section.

You may want to change the 'Minimum Level' to define the threshold value for the log entries to be written to the file. Supported log levels in Serilog:

  • Verbose
  • Debug
  • Information
  • Warning
  • Error
  • Fatal

Below you will find an example configuration for the log settings area:

{
  "Serilog": {
    "Using": [
      "Serilog.Sinks.File"
    ],
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "File",
        "Args": {
          "path": "C:\\ELO\\logsLogs\\ELO-Sync\\ELO-Sync.txt",
          "rollingInterval": "Day"
        }
      }
    ],
    "Enrich": [
      "FromLogContext",
      "WithMachineName",
      "WithThreadId"
    ],
    "Properties": {
      "Application": "Sample"
    }
  }
}

Important

The log level must also be set in the 'Logging' section, not only in the 'Serilog' section.

These logging settings define the actual log level that is used for the individual components.

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Elo": "Trace"
    }
  }
}

The following values are supported for "LogLevel":

  • Trace
  • Debug
  • Information
  • Warning
  • Error
  • Critical
  • None
Dernière mise à jour: 21 février 2025 à 09:59