Serilog ignoring minimumlevel override

Viewed 229

.Net core 2.2 web API application. I can't get the MinimumLevel overrides to work. Serilog is always logging informational logs from the Microsoft.* namespaces.

How do I set those to warning only?

 "SeriLog": {
    "IsEnabled": true,
    "UseSerilogRequestLogging": false,
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Warning",
        "Microsoft.AspNetCore.Routing.EndpointMiddleware": "Warning",
        "System": "Warning"
      }
    },
    "AsyncMsSqlServer": {
      "IsEnabled": true,
      "ConnectionString": "xxxxxxxxxxxxxxxx",
      "RestrictedToMinimumLevel": "Information",
      "BatchPostingLimit": 50,
      "PeriodInSeconds": 5
    }
  }

Here are some of the namespaces that are logging and should not be:

Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker
Microsoft.AspNetCore.Routing.EndpointMiddleware
Microsoft.AspNetCore.Hosting.Internal.WebHost
Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor
0 Answers
Related