Skip to content

.NET Framework: Configuring Enrichers from json does not work #122

@aFuerst

Description

@aFuerst

Does this issue relate to a new feature or an existing bug?

  • Bug
  • New Feature

What version of Serilog is affected? Please list the related NuGet package.
Serilog, Version=2.0.0.0
Serilog.Enrichers.Process, Version=2.0.0.0
Serilog.Enrichers.Thread, Version=2.0.0.0
Serilog.Enrichers.Environment, Version=2.0.0.0
Serilog.Settings.Configuration, Version=2.6.1.0

What is the target framework and operating system? See target frameworks & net standard matrix.

  • netCore 2.0
  • netCore 1.0
  • 4.7
  • 4.6.x
  • 4.5.x

Please describe the current behavior?
Enrichers configured via json configuration are not applied.
The created logger has an empty enricher.

Please describe the expected behavior?
The enrichers specified in the json config should be applied to the created logger and the data they are supposed to add gets put in the logs

If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem
This is the config section I have

"Serilog": {
	"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId", "WithExceptionDetails" ],
	"MinimumLevel": "Verbose",
	"WriteTo": [
		{
			"Name": "Trace",
			"Args": {
				"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
			}
		}
	],
	"Using": [ "Serilog.Sinks.Trace" ]
}

We're using the full .NET Framework.
The logger creation looks like this. We load it entirely from the IConfiguration object.

var logger = new LoggerConfiguration()
	.ReadFrom.Configuration(config)
	.CreateLogger();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions