You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2025-04-01-nlog-6-0-major-changes.md
+7-25Lines changed: 7 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ NLog 6.0 is a major version release that introduces breaking changes, including
10
10
### NLog supports AOT
11
11
12
12
NLog has traditionally relied on reflection to dynamically discover requirements for target output.
13
-
But reflection does not always work well with build trimming, and before NLog marked itself to have trimming disabled.
13
+
But reflection does not always work well with build trimming, and before NLog marked itself to be excluded from trimming.
14
14
15
15
NLog includes many features, each of these feature often introduce additional dependencies on the .NET library.
16
16
This can lead to overhead for AOT builds, as it must include and compile all the relevant source code.
@@ -25,32 +25,11 @@ NLog v6 attempts to reduce its footprint by extracting several features into sep
25
25
- NLog.Targets.Trace - Depends on System.Diagnostics.TraceListener.
26
26
- NLog.Targets.WebService - Depends on System.Net.Http.HttpClient.
27
27
28
-
NLog v6 also no longer supports automatic loading of `NLog.config`-file. This is because dynamic configuration
29
-
loading, prevents build trimming of any NLog types, as the AOT-build cannot determine upfront what types
30
-
will be used by the `NLog.config`-file.
28
+
NLog v6 also no longer depends on `System.Xml.XmlReader`, but now includes its own basic XmlParser for loading `NLog.config` files.
31
29
32
-
### NLog without automatic loading of NLog.config
30
+
NLog v6 still introduces an overhead when compared with just using `Console.WriteLine`,
31
+
but now reduced to 5 MByte in comparison to 14 MBytes for NLog v5.
33
32
34
-
NLog will no longer automatically load the NLog LoggingConfiguration, when creating the first NLog Logger by calling `LogManger.GetCurrentClassLogger()` or `LogManger.GetLogger()`.
35
-
36
-
Instead one must explicit load the `NLog.config` file at application-startup:
When using Microsoft HostBuilder with `UseNLog()`, then it will continue to automatically load the NLog LoggingConfiguration without having to make any changes.
43
-
44
-
.NET Framework will continue to probe NLog LoggingConfiguration from the `app.config` / `web.config`, so one can consider doing this:
0 commit comments