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-29-nlog-6-0-major-changes.md
+22-21Lines changed: 22 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,14 @@ This can lead to overhead for AOT builds, as it must include and compile all the
17
17
18
18
NLog v6 attempts to reduce its footprint by extracting several features into separate nuget-packages:
19
19
20
-
- NLog.RegEx - Depends on System.Text.RegularExpressions which is a huge dependency for a logging library.
21
-
- NLog.Targets.ConcurrentFile - ConcurrentWrites using global mutex from operating system API.
22
-
- NLog.Targets.AtomicFile - ConcurrentWrites using atomic file-append from operating system API.
23
-
- NLog.Targets.GZipFile - EnableArchiveFileCompression using GZipStream for writing GZip compressed log-files.
24
-
- NLog.Targets.Mail - Depends on System.Net.Mail.SmtpClient.
25
-
- NLog.Targets.Network - Depends on TCP and UDP Network Socket, and adds support for Syslog and Graylog.
26
-
- NLog.Targets.Trace - Depends on System.Diagnostics.TraceListener.
27
-
- NLog.Targets.WebService - Depends on System.Net.Http.HttpClient.
20
+
-[NLog.Targets.AtomicFile](https://www.nuget.org/packages/NLog.Targets.AtomicFile) - ConcurrentWrites using atomic file-append from operating system API.
21
+
-[NLog.Targets.ConcurrentFile](https://www.nuget.org/packages/NLog.Targets.ConcurrentFile) - ConcurrentWrites using global mutex from operating system API.
22
+
-[NLog.Targets.GZipFile](https://www.nuget.org/packages/NLog.Targets.GZipFile) - EnableArchiveFileCompression using GZipStream for writing GZip compressed log-files.
23
+
-[NLog.Targets.Mail](https://www.nuget.org/packages/NLog.Targets.Mail) - Depends on System.Net.Mail.SmtpClient.
24
+
-[NLog.Targets.Network](https://www.nuget.org/packages/NLog.Targets.Network) - Depends on TCP and UDP Network Socket, and adds support for Syslog and Graylog.
25
+
-[NLog.Targets.Trace](https://www.nuget.org/packages/NLog.Targets.Trace) - Depends on System.Diagnostics.TraceListener.
26
+
-[NLog.Targets.WebService](https://www.nuget.org/packages/NLog.Targets.WebService) - Depends on System.Net.Http.HttpClient.
27
+
-[NLog.RegEx](https://www.nuget.org/packages/NLog.RegEx) - Depends on System.Text.RegularExpressions which is a huge dependency for a logging library.
28
28
29
29
NLog v6 also no longer depends on `System.Xml.XmlReader`, but now includes its own basic XmlParser for loading `NLog.config` files.
30
30
@@ -75,24 +75,24 @@ NLog FileTarget no longer has the following options:
75
75
- ArchiveDateFormat - Marked as obsolete. Instead use new ArchiveSuffixFormat
76
76
- ArchiveNumbering - Marked as obsolete. Instead use new ArchiveSuffixFormat (Rolling is unsupported).
77
77
78
-
If one still requires these options, then one can use the new NLog.Targets.ConcurrentFile-nuget-package.
79
-
NLog.Targets.ConcurrentFile-nuget-package is the original NLog FileTarget with all its features and complexity.
80
-
The goal is that NLog.Targets.ConcurrentFile-nuget-package should become legacy, but it might help some when upgrading to NLog v6.
78
+
If one still requires these options, then one can use the new [NLog.Targets.ConcurrentFile](https://www.nuget.org/packages/NLog.Targets.ConcurrentFile)-nuget-package.
79
+
[NLog.Targets.ConcurrentFile](https://www.nuget.org/packages/NLog.Targets.ConcurrentFile)-nuget-package is the original NLog FileTarget with all its features and complexity.
80
+
The goal is that [NLog.Targets.ConcurrentFile](https://www.nuget.org/packages/NLog.Targets.ConcurrentFile)-nuget-package should become legacy, but it might help some when upgrading to NLog v6.
81
81
82
82
Alternative options for replacing `ConcurrentWrites = true`:
83
-
- Use the new nuget-package NLog.Targets.AtomicFile where AtomicFileTarget uses atomic file-appends and supports Windows / Linux with NET8.
83
+
- Use the new nuget-package [NLog.Targets.AtomicFile](https://www.nuget.org/packages/NLog.Targets.AtomicFile) where AtomicFileTarget uses atomic file-appends and supports Windows / Linux with NET8.
84
84
- Change to use `KeepFileOpen = false` where file is opened / closed when writing LogEvents. Recommended to use `<targets async="true">`.
85
85
86
86
Alternative options for replacing `EnableArchiveFileCompression = true`:
87
87
- Activate NTFS compression for the logging-folder.
88
88
- Setup cron-job / scheduled-task that performs ZIP-compression and cleanup of the logging-folder.
89
89
- Implement background task in the application, which monitors the logging-folder and performs ZIP-compression and cleanup.
90
-
- Use the new nuget-package NLog.Targets.GZipFile where GZipFileTarget writes directly to a compressed log-file using GZipStream.
90
+
- Use the new nuget-package [NLog.Targets.GZipFile](https://www.nuget.org/packages/NLog.Targets.GZipFile) where GZipFileTarget writes directly to a compressed log-file using GZipStream.
91
91
92
92
### NLog AtomicFileTarget without mutex
93
93
94
-
New AtomicFileTarget has been introduced, that supports atomic file-append with help from the operating system,
95
-
and supports both Windows and Linux (with help from Mono Posix) for NET8 (and newer).
94
+
New AtomicFileTarget has been introducedwith [NLog.Targets.AtomicFile](https://www.nuget.org/packages/NLog.Targets.AtomicFile),
95
+
that supports atomic file-append with help from the operating system, and supports both Windows and Linux (with help from Mono Posix) for NET8 (and newer).
96
96
97
97
Extends the standard FileTarget and adds support for `ConcurrentWrites = true`, but without using global mutex.
98
98
@@ -101,7 +101,8 @@ correct publish of the `Mono.Posix.NETStandard`-nuget-package dependency.
101
101
102
102
### NLog GZipFileTarget with GZipStream
103
103
104
-
New GZipFileTarget has been introduced, that writes directly to a compressed log-file using GZipStream.
104
+
New GZipFileTarget has been introduced with [NLog.Targets.GZipFile](https://www.nuget.org/packages/NLog.Targets.GZipFile) nuget-package,
105
+
that writes directly to a compressed log-file using GZipStream.
105
106
106
107
Extends the standard FileTarget and adds support for `EnableArchiveFileCompression = true`, but only supports
107
108
GZip file compression.
@@ -130,7 +131,7 @@ but will only perform synchronous NLog Target Close.
130
131
131
132
### NLog GelfTarget and GelfLayout
132
133
133
-
The NLog.Targets.NetworkTarget nuget-package also includes support for the Graylog Extended Log Format (GELF).
134
+
The [NLog.Targets.Network](https://www.nuget.org/packages/NLog.Targets.Network) nuget-package also includes support for the Graylog Extended Log Format (GELF).
134
135
135
136
The `GelfTarget` extends the standard `NetworkTarget` with the new `GelfLayout`.
136
137
@@ -139,15 +140,15 @@ custom property-names with underscore `_`.
139
140
140
141
### NLog SyslogTarget and SyslogLayout
141
142
142
-
The NLog.Targets.NetworkTarget nuget-package also includes support for the Syslog Output Format.
143
+
The [NLog.Targets.Network](https://www.nuget.org/packages/NLog.Targets.Network) nuget-package also includes support for the Syslog Output Format.
143
144
144
145
The `SyslogTarget` extends the standard `NetworkTarget` with the new `SyslogLayout`.
145
146
146
147
The `SyslogLayout` supports both RFC-3164 (simple) + RFC-5424 (structured) logging output.
147
148
148
149
### NLog NetworkTarget with NoDelay = true
149
150
150
-
The NLog.Targets.NetworkTarget nuget-package includes support for configuring TCP_NODELAY.
151
+
The [NLog.Targets.Network](https://www.nuget.org/packages/NLog.Targets.Network) nuget-package includes support for configuring TCP_NODELAY.
151
152
The `NetworkTarget` will by default use `NoDelay = true` to turn off delayed ACK,
152
153
to avoid delays of 200ms because of nagle-algorithm.
153
154
@@ -156,7 +157,7 @@ a delay of 200ms.
156
157
157
158
### NLog NetworkTarget with SendTimeoutSeconds = 100
158
159
159
-
The NLog.Targets.NetworkTarget nuget-package changes the default value of TCP SendTimeout
160
+
The [NLog.Targets.Network](https://www.nuget.org/packages/NLog.Targets.Network) nuget-package changes the default value of TCP SendTimeout
160
161
from waiting forever to 100 secs.
161
162
162
163
The `NetworkTarget` should now react to the network-cable being unplugged and the TCP send-window being filled.
@@ -165,7 +166,7 @@ The `NetworkTarget` should now automatically attempt to reconnect when the endpo
165
166
166
167
### NLog NetworkTarget with SslCertificateFile
167
168
168
-
The NLog.Targets.NetworkTarget nuget-package introduces the ability to specify custom SSL certificate from file.
169
+
The [NLog.Targets.Network](https://www.nuget.org/packages/NLog.Targets.Network) nuget-package introduces the ability to specify custom SSL certificate from file.
169
170
170
171
The `NetworkTarget` now recognizes these new settings:
0 commit comments