-
Notifications
You must be signed in to change notification settings - Fork 1.4k
W3CExtendedLogLayout
Rolf Kristensen edited this page Dec 28, 2021
·
4 revisions
A specialized layout that renders to W3C Extended Log Format (ELF)
Platforms Supported: All
Introduced with NLog.Web 5.0
<target name="w3cFile" xsi:type="File" fileName="log-file.json" >
<layout xsi:type="W3CExtendedLogLayout">
<directive name="Software" layout="My Web Server" /> <!-- Optional - Can be repeated -->
<field name="cs-method" layout="${aspnet-request-method}" /> <!-- Optional - Can be repeated -->
</layout>
</target>
Note default fields will be printed, when no fields has been specified. Same behavior for directives.
-
field
- name - Required. The name of the W3C Extended Field
- layout - The layout value of the W3C Extended Field
-
directive
- name - Required. The name of the W3C Extended Directive Header
- layout - The layout value of the W3C Extended Directive Header
Available W3C log-parsers:
- https://github.com/jibedoubleve/log-reader
- https://support.microsoft.com/en-us/topic/log-parser-2-2-and-asp-net-37531636-1cf5-dc52-f12a-6a9252155631
- https://techcommunity.microsoft.com/t5/exchange-team-blog/introducing-log-parser-studio/ba-p/601131
- https://www.finalanalytics.com/products/httplogbrowser
- Troubleshooting Guide - See available NLog Targets and Layouts: https://nlog-project.org/config
- Getting started
- How to use structured logging
- Troubleshooting
- FAQ
- Articles about NLog
-
All targets, layouts and layout renderers
Popular: - Using NLog with NLog.config
- Using NLog with appsettings.json