.netserilogappsettingsseq-logging

Serilog - AppSettings for Application name


I am trying to read the application name from the App.Config. This is net461 console app. I have added the Serilog.Settings.AppSettings package. And also added the following serilog configs on App.Config

<add key="serilog:properties:Application" value="My App"/>
<add key="serilog:minimum-level" value="Debug" />
<add key="serilog:minimum-level:override:Microsoft" value="Debug" />
<add key="serilog:enrich:FromLogContext"/>
<add key="serilog:enrich:WithMachineName"/>
<add key="serilog:enrich:WithProcessId"/>
<add key="serilog:using:Seq" value="Serilog.Sinks.Seq"/>
<add key="serilog:write-to:Seq.serverUrl" value="http://localhost:5341" />
<add key="serilog:using:Console" value="Serilog.Sinks.Console" />
<add key="serilog:write-to:Console"/>

But the application name is not displaying on Seq. However, I have added the following settings on appsettings.json for a .netcore2 project, this works as expected

"Serilog": {
  "Properties": {
    "Application": "Another app"
  }
}

What is missing?


Solution

  • I believe you need:

    <add key="serilog:enrich:with-property:Application" value="My App" />
    

    (Rather than "serilog:properties...)