Log4JXmlEventLayout
A specialized layout that renders Log4j-compatible XML events.
Platforms Supported: All
Notice that Chainsaw-target works as a combined solution for sending Log4j-XML events over TCP / UDP / HTTP.
Notice that ${log4jxmlevent} can be used for shorthand-notation (when not needing additional context-parameters)
<targets>
<target xsi:type="SomeTarget">
<layout xsi:type="Log4JXmlEventLayout" includeEventProperties="true">
<parameter name="processId" value="${processid}" /> <!-- Repeated -->
</layout>
</target>
</targets>
-
appInfo - AppInfo field. By default it's the friendly name of the current AppDomain.
Introduced in NLog 5.0
-
loggerName - Logger field. By default it's the output of
${logger}
Introduced in NLog 5.0
-
formattedMessage - Message field. By default it's the output of
${message}
Introduced in NLog 5.3
-
IncludeEventProperties - Include all events properties of a logevent as
log4j:data
? Default:true
.Before NLog 5.0 option was named IncludeAllProperties with Default:
false
-
IncludeScopeProperties - Indicates whether to include ScopeContext Properties as
log4j:data
. 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:
-
includeSourceInfo - Indicates whether to include source info (file name and line number). Default:
false
.Introduced in NLog 4.6.5
-
includeCallSite - Indicates whether to include call site (class and method name). Default:
false
.Introduced in NLog 4.6.5
-
includeNLogData - Indicates whether to include NLog-specific extensions to log4j schema. Default:
false
.Before NLog 5.0 option had Default:
true
. -
WriteThrowableCData - Write Exception as CDATA in log4j:throwable xml-element (Not supported by all viewers). Default:
false
.Introduced in NLog 5.0
-
parameter - Additional context properties that should be included as
log4j:data
Introduced in NLog 4.6.4
- name - Name of Parameter. Required.
- layout - The layout for the Parameter-Value. Required.
- Troubleshooting Guide - See available NLog Targets and Layouts: https://nlog-project.org/config
- Getting started
- How to use structured logging
- Troubleshooting
- FAQ
-
All targets, layouts and layout renderers
Popular: - Using NLog with NLog.config
- Using NLog with appsettings.json