Skip to content

Missing trace\debug logs in ASP.NET Core 6?

Rolf Kristensen edited this page Aug 18, 2022 · 8 revisions

Missing the trace and debug logs in ASP.NET Core 6?

Check your appsettings.json

The following is advised:

{
  "Logging": {
    "LogLevel": {
      "Default": "Trace",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*"
}

⚠️ Make sure also to check any environment specific appsettings.json. Ex. appsettings.development.json

Notice NLog.Web.AspNetCore ver. 5 will by default ignore any filters configured in appsettings.json for Microsoft LoggerFactory. The options ReplaceLoggerFactory and RemoveLoggerFactoryFilter in NLogAspNetCoreOptions can be used to re-enable the old behavior. Example:

.UseNLog(new NLogAspNetCoreOptions() { RemoveLoggerFactoryFilter = false });

Clone this wiki locally