Skip to content

Commit 6366847

Browse files
committed
NLog v6 - FileTarget with ArchiveSuffixFormat
1 parent 35587cd commit 6366847

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

_posts/2025-04-29-nlog-6-0-major-changes.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ NLog FileTarget no longer has the following archive-options:
7070
- ArchiveFileKind - Removed because it is now implicit.
7171
- FileNameKind - Removed because it is now implicit.
7272

73-
The `ArchiveSuffixFormat`-option has been introduced to handle `{#}`, and instead of specifying
74-
`archiveFilename="LogFile.{##}.txt"` then one should specify `archiveFilename="LogFile.txt"` with `archiveSuffixFormat="{1:yyyyMMdd}_{0:00}"`.
75-
The `ArchiveSuffixFormat`-option doesn't support NLog Layout, and works like `string.Format` and supports these place-holders:
73+
The `ArchiveSuffixFormat`-option has been introduced to replace `{#}`, and instead of specifying
74+
`archiveFilename="LogFile_{##}.txt"` then one should specify `archiveFilename="LogFile.txt"` with `archiveSuffixFormat="_{1:yyyyMMdd}_{0:00}"`.
75+
The `ArchiveSuffixFormat`-option specifies the filename-suffix to apply, when the archive-logic is rolling to the next file.
76+
It is intended to be very basic to simplify the file-wildcard-logic, and has no NLog Layout-logic. Instead it works like `string.Format` with support for these place-holders:
7677
- `{0}` - The archive sequence-number. Supports format option `{0:000}`.
7778
- `{1}` - The archive created-datetime. Supports format option `{1:yyyyMMdd}` (Only works when also specifying `archiveFileName="..."`).
7879

0 commit comments

Comments
 (0)