Serilog - AppSettings for Application name

MJK

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

I believe you need:

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

(Rather than "serilog:properties...)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to overwrite application name specified in appsettings.json when using Serilog?

Serilog - AppSettings MinLevel not working

Custom Serilog sink dont work using AppSettings

Serilog appsettings config with custom format provider

How to use ReadFrom.AppSettings in Serilog

Serilog PushProperty in appsettings-configuration not working

Problems configuring Serilog from appSettings.json

Trouble converting Serilog Configuration to appsettings.json

Serilog filter by method name

Problems with serilog.settings.appsettings and file rollover interval

Serilog and Filters from Filters.Expressions in appsettings.json

Serilog asp.net core appsettings config for syslog

Attempting to reading Serilog config from appsettings.json

How to override serilog settings using appsettings.json

Is there a way to set Serilog formatter variables via appsettings.json?

Trying to Configure Serilog Email sink with appsettings.json to work with Gmail

Configure Column Options for Serilog Sinks MsSqlServer in AppSettings.json

Serilog : RollingFile is not working in asp.net core with 'appsettings.json'

Serilog show the property name in the output

Setting url of application from appsettings

What file name placeholders are available for Serilog?

Serilog - how to customize date in rolling file name?

Serilog machine name enricher for rolling file sink

serilog format SourceContext for showing only assembly name

NLog use Connection String Name in appsettings

How to Manage AppSettings by Build Configuration name not Environment?

Serilog logger for each plugin DLL in One Application

Using serilog with azure application insights and .Net core

Using outputTemplate argument in Serilog with Azure Application Insights