.NET Framework: Configuring Enrichers from json does not work
See original GitHub issueDoes 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();
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (7 by maintainers)
Ah, yes, the “Using” blocks are only redundant in Core, IIRC the dependency context works differently on Framework 😕
Hi, @mikeblas . Just checked with 3.1 - works as expected. Can you provide your setup or minimal code that reproduce this? Thanks!