NLog 6.0 goals

01 Oct 2024

NLog v6.0 has the following goals:

  • Support Ahead-of-Time (AOT) builds without warnings
  • Support Nullable references
  • Remove old target platforms NetStandard1.3 + NetStandard1.5
  • Cleanup interfaces for Logger / ILogger to remove unnecessary boxing optimizations from .NET v1
  • Remove System.Text.RegularExpressions dependency since a heavy dependency for AOT
    • Need to implement a minimal syntax-support for NLog Logging Rules. Ex. ? and *
  • Remove System.Xml dependency since a heavy dependency for AOT
    • Need to implement a minimal XML reader to continue loading NLog.config XML files
  • Extract NLog.Targets.WebServiceTarget to its own nuget-package
  • Extract NLog.Targets.NetworkTarget to its own nuget-package
  • Extract NLog.Targets.MailTarget to its own nuget-package
  • Extract NLog.Targets.FileTarget to its own nuget-package NLog.Targets.ConcurrentFileTarget
    • NLog will instead have a simple FileTarget without ConcurrentWrites-support but only KeepFileOpen = false

The overall goal for NLog v6.0 is to continue being a fully working logging-library in a single nuget-package. The NLog-package will out of the box only handle file- and console-output, which will probably cover 90 pct. of the use cases. When needing other output targets or formats, then additional nuget-packages must be included.

The planned interface cleanup for Logger / ILogger will probably give a lot of headache, as it will require all dependencies to be upgraded before upgrading the main-application. Where NLog v5 was mostly an update of default values for the main-application to handle, then the upgrade to NLog v6 will affect the entire dependency- / project-tree.

Another goal is that all existing nuget-packages that depends on NLog v4, should continue to function with NLog v6. This means NLog v6 will continue to support obsolete API-methods, that are relevant for custom NLog targets.

.NET8 already have great support for AOT, but many Microsoft teams are still working on updating their nuget-packages to support AOT. Believe the goal for .NET9 is to ensure even more nuget-packages will fully support AOT, to allow more ASP.NET or MAUI applications to start using AOT. NLog should not become a blocker, when wanting to try out AOT builds.

This means NLog v5 will now go into maintenance mode (together with NLog v4), and focus will now be on getting NLog v6 preview build ready. If having suggestions for the future direction of the NLog v6 milestone then comments are wellcome.