serilog-sinks-elasticsearch icon indicating copy to clipboard operation
serilog-sinks-elasticsearch copied to clipboard

Setting `typeName: null` from appsettings.json

Open snebjorn opened this issue 3 years ago • 0 comments
trafficstars

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

  • [x] Bug
  • [ ] New Feature

What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package. serilog.sinks.elasticsearch v8.4.1

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? Given this appsettings.json

{
  "Serilog": {
    "Using": ["Serilog.Sinks.Elasticsearch"],
    "WriteTo": {
      "ElasticsearchSink": {
        "Name": "Elasticsearch",
        "Args": {
          "nodeUris": "...",
          "typeName": null
        }
      }
    }
  }
}

then the typeName isn't set to null in the config.

Please describe the expected behavior?

The expected behavior is that when "typeName": null is set on the ElasticsearchSink appsettings.json config it should configure the TypeName to be null.

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

Given the above config, load it using the Serilog.Settings.Configuration extension

.UseSerilog(
    (context, services, configuration) =>
    {
        configuration.ReadFrom.Configuration(context.Configuration);
    }
)

snebjorn avatar Oct 10 '22 09:10 snebjorn