Skip to content

FileTarget with ArchiveSuffixFormat doesn't format the date as expected #5920

@13xforever

Description

@13xforever

NLog version: 6.0.1

Platform: .NET9 on Windows 11 24H2 and Ubuntu 24.04

Current NLog config (xml or C#, if relevant)

var fileTarget = new FileTarget("logfile") {
            FileName = Path.GetFullPath(Path.Combine(LogPath, "bot.log")),
            ArchiveEvery = FileArchivePeriod.Day,
            ArchiveSuffixFormat = ".{1:yyyyMMdd}.{0:0}",
            MaxArchiveDays = 30,
            KeepFileOpen = true,
            AutoFlush = false,
            OpenFileFlushTimeout = 1,
            Layout = "…",
};
  • What is the current result?
    • On Windows: bot..1.log
    • On Linux: bot..250705.log (???)
  • What is the expected result?
    I'd expect to see bot.20250705.0.log on all platforms
  • Did you check the Internal log?
    No
  • Please post full exception details (message, stacktrace, inner exceptions)
  • Are there any workarounds? yes/no
  • Is there a version in which it worked?
    I just want consistent naming after upgrading from v5
  • Can you help us by writing a unit test?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions