NLog 6.0 with AOT support

21 Jun 2025

NLog v6 includes the following major changes:

  • Support Ahead-of-Time (AOT) builds without warnings.
  • Support Nullable references.
  • Support ReadOnlySpan to reduce memory allocations.
  • LogFactory supports FlushAsync and IDisposableAsync.
  • FileTarget removed support for ConcurrentWrites.
  • FileTarget refactored file-archive-logic with ArchiveSuffixFormat.

NLog v6 has reduced its footprint by extracting features into separate nuget-packages:

  • NLog.Targets.AtomicFile - FileTarget with ConcurrentWrites using atomic file-append from operating system API.
  • NLog.Targets.ConcurrentFile - Legacy FileTarget from NLog v5 with ConcurrentWrites using global operating system mutex.
  • NLog.Targets.GZipFile - FileTarget with EnableArchiveFileCompression using GZipStream for writing GZip compressed log-files.
  • NLog.Targets.Mail - MailTarget depends on System.Net.Mail.SmtpClient.
  • NLog.Targets.Network - NetworkTarget depends on TCP and UDP Network Socket, and adding support for Syslog and Graylog.
  • NLog.Targets.Trace - TraceTarget and NLogTraceListener depends on System.Diagnostics.TraceListener and System.Diagnostics.Trace.
  • NLog.Targets.WebService - WebServiceTarget depends on System.Net.Http.HttpClient.
  • NLog.RegEx - Depends on System.Text.RegularExpressions which is a huge dependency for a logging library.

See also List of major changes in NLog v6 for more details.

Many other improvements

Full list of all changes: NLog 6.0 Pull Requests

Comments and feedback are welcome.

Credits

Additional thanks to all contributers, since last major release: