7

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?

Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101
MJK
  • 3,434
  • 3
  • 32
  • 55
  • My company has found that adding the application name is easier to do within Seq by adding an applied property to your API key. Of course, this only affects Seq, so if you have other sinks you may still want to specify the application name within the application. We also add additional properties such as environment and sub-application that make it easier to filter. – mason Feb 01 '18 at 23:45

1 Answers1

8

I believe you need:

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

(Rather than "serilog:properties...)

Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101