Adding Serilog Enrichers using App Config

Viewed 1435

For Serilog logs enrichment using an App config how can i add standard enrichers like ProcessId, ThreadId, MachineName? The syntax to add property enricher is below but am trying to use the above standard enrichers. There's an option to implement application json which i want to avoid as it needs Serilog 2.6. Any ideas how this can be done?

<add key="serilog:enrich:with-property:Version" value="1.0" />
1 Answers

Add the standard enricher with the below syntax, you also need to refer the dll for the enricher, see below for ThreadId enricher.

    <add key="serilog:using:Thread" value="Serilog.Enrichers.Thread" />
    <add key="serilog:enrich:WithThreadId" /> 
Related