Skip to content

Log4JXMLEvent Layout Renderer

Rolf Kristensen edited this page Jun 22, 2025 · 19 revisions

XML event description compatible with log4j, Chainsaw and NLogViewer.

Platforms Supported: All (Since NLog v6 then it has been replaced by Log4JXmlEventLayout)

Notice that Log4JXml-target works as a combined solution for sending Log4j-XML events over TCP / UDP / HTTP.

Configuration Syntax

${log4jxmlevent:includeEventProperties=Boolean:includeSourceInfo=Boolean:includeCallSite=Boolean
               :includeNdc=Boolean:ndcItemSeparator=String:appInfo=String:indentXml=Boolean}

Parameters

Payload Options

  • appInfo - AppInfo field. By default it's the friendly name of the current AppDomain.

  • loggerName - Logger field. By default it's the output of ${logger}

    Introduced in NLog 4.5

  • formattedMessage - Message field. By default it's the output of ${message}

    Introduced in NLog 5.3

  • includeSourceInfo - Indicates whether to include source info (file name and line number) in the information sent over the network. Boolean

  • includeCallSite - Indicates whether to include call site (class and method name) in the information sent over the network. Boolean

  • IncludeEventProperties - Include all events properties of a logevent? Default: true.

    Before NLog 5.0 option was named IncludeAllProperties with Default: false

  • IncludeScopeProperties - Indicates whether to include ScopeContext Properties dictionary. Default: false.

    Before NLog 5.0 option was named IncludeMdlc or IncludeMdc

  • IncludeScopeNested - Indicates whether to include ScopeContext Nested Stack as NDC. Default: false.

    Before NLog 5.0 option was named IncludeNdlc

  • ScopeNestedSeparator - NDC item separator. Default:

    Before NLog 5.0 option was named NdlcItemSeparator

  • includeNdc - Indicates whether to include ScopeContext Nested Stack. Default: false.

  • ndcItemSeparator - NDC item separator. Default:

  • WriteThrowableCData - Write Exception as CDATA in log4j:throwable xml-element (Not supported by all viewers). Default: false

    Introduced in NLog 5.0

  • indentXml - Indicates whether to enable XmlWriterSettings.Indent for XML indentation. Default: false.

  • includeNLogData - Indicates whether to include NLog-specific extensions to log4j schema. Default: false.

    Before NLog 5.0 option had Default: true.

Clone this wiki locally