Skip to content

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.

Parameters

  • 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

Notes

Available W3C log-parsers:

Clone this wiki locally