Skip to content
Rolf Kristensen edited this page Jul 26, 2026 · 7 revisions

Writes LogEvents to file using operating system API for atomic file appending (O_APPEND), so multiple processes can write concurrently to the same file, by extending the standard NLog File Target.

Platforms Supported: NET8 or .NET Framework - Requires nuget-package NLog.Targets.AtomicFile

Configuration Syntax

<targets>
  <target xsi:type="AtomFile"
          name="string"
          fileName="Layout"
          layout="Layout"
          concurrentWrites="boolean"
          keepFileOpen="boolean"
  />
</targets>

Parameters

  • fileName - Name of the file to write to. Layout Required.
  • layout - Text to be rendered. Layout Required.

    Default: ${longdate}|${level:uppercase=true}|${logger}|${message:withexception=true}

  • concurrentWrites - Whether to enable atomic file appends. Default: true
  • keepFileOpen - Disables atomic file appends when configured to false. Default: true

Also inherits all parameters from the standard File-Target.

Linux Support

Uses libc open() with O_APPEND flag, which is supported on Linux and other Unix-like operating systems.

Clone this wiki locally