Skip to content

Logger Layout Renderer

Rolf Kristensen edited this page Mar 31, 2024 · 10 revisions

Renders name of the Logger that produced the LogEvent. The Logger name is assigned when it is created using NLog.LogManager.GetLogger("myLoggerName") or NLog.LogManger.GetCurrentClassLogger() (capture class-type-name as Logger-name)

The Logger-name is often used to describe the source-location where the LogEvent was produced. The NLog Logging-Rules are optimized for doing filtering / redirection of LogEvents based on the Logger-name. It is not recommended to generate Logger-name from Guid or Timestamp, as it can lead to memory-leak with huge Logger-cache.

Platforms Supported: All

Configuration Syntax

${logger:shortName=Boolean}

Parameters

Rendering Options

  • shortName - Indicates whether to render short logger name (the part after the last trailing dot character). Boolean Default: False
  • prefixName - Indicates whether to render prefix-part of logger name (the part before the last trailing dot character). Boolean Default: False

    Introduced with NLog v5.3

Clone this wiki locally