Skip to content

Configure Enrichers & Properties

Khaos edited this page Apr 29, 2021 · 8 revisions

Enrich

Enricher with zero arguments

<Serilog>
  <Using>Serilog.Enrichers.Thread</Using>
  <Enrich Name="WithThreadId" />
</Serilog>

Enricher with simple argument types

<Serilog>
  <Enrich Name="WithProperty">
    <Name>MyProperty</Name>
    <Value>123</Value>
  </Enrich>
</Serilog>

Enricher using static values as arguments. Pattern: <Namespace.Class>::<StaticProperty>, <Assembly>

<Serilog>
  <Enrich Name="WithProperty">
    <Name>Serilog.Enrichers.ThreadNameEnricher::ThreadNamePropertyName, Serilog.Enrichers.Thread</Name>
    <Value>DefaultThread</Value>
  </Enrich>
</Serilog>

Property

<Serilog>
  <Property Name="MyProperty" Value="Property-Value" />
</Serilog>

or

<Serilog>
  <Property Name="MyProperty">Property-Value</Property>
</Serilog>
Clone this wiki locally