Skip to content

Notes GetLogger injected ILogger

Rolf Kristensen edited this page Sep 17, 2021 · 2 revisions

Some important notes:

  • The configuration in LogManager.Configuration will be used for LogManager.GetLogger/LogManager.GetCurrentClassLogger and injected ILogger<T>
  • When using "Microsoft.Extensions.DependencyInjection", the injected ILogger<T> is preferred over LogManager.GetLogger/LogManager.GetCurrentClassLogger
  • When using the injected ILogger<T>, you need to enable the integration with builder.AddNLog (that's in your code example).

See also NLog-GetCurrentClassLogger-and-Microsoft-ILogger