Closed vpoorshab closed 5 years ago
I think we broke that functionality @tsvetelintsonev. Not sure how to make it compatible, since I don't use serilog-settings-configuration
@huan086 Yes, we definitely have broken this functionality. I will repro this later today. I hope that adding a parameterless constructor to RabbitMQSinkConfiguration will fix it.
I am using a .net core web application when updating the serilog.sink.rabitmq to v3.0.0 the sink is not picking the configuration from the appsettings, I tried to adjust the setting with the new(breaking) change in version 3, I could not find any explicit guide how version 3 should be set up in appsettings.json so I tried the nested configuration according to https://github.com/serilog/serilog-settings-configuration#nested-configuration-sections but get an exception, is there any way to add configuration settings in the appsettings.json or it should be manually set up in the code?
working settings with version 2
"WriteTo": [{ "Name": "RabbitMQ", "Args": { "Hostname": "", "Username": "", "Password": "", "Exchange": "", "ExchangeType": "", "DeliveryMode": "", "Port": 5672, "Formatter": "Serilog.Formatting.Compact.RenderedCompactJsonFormatter, Serilog.Formatting.Compact", "restrictedToMinimumLevel": "Warning" } }]
new setting according to version 3 changes
"WriteTo": [{ "Name": "RabbitMQ", "Args": { "configure": [ { "Name": "RabbitMQClientConfiguration", "Args": { "Hostnames": [ "" ], "Username": "", "Password": "", "Exchange": "", "ExchangeType": "", "DeliveryMode": "", "Port": } }, { "Name": "RabbitMQSinkConfiguration", "Args": { "textFormatter": "Serilog.Formatting.Compact.RenderedCompactJsonFormatter, Serilog.Formatting.Compact", "restrictedToMinimumLevel": "Warning" } } ] } }]
Startup.cs
loggerConfiguration.Enrich.FromLogContext().ReadFrom.Configuration(Configuration);
the exception
Cannot create instance of type 'System.Action2[Serilog.Sinks.RabbitMQ.Sinks.RabbitMQ.RabbitMQClientConfiguration,Serilog.Sinks.RabbitMQ.Sinks.RabbitMQ.RabbitMQSinkConfiguration]' because it is missing a public parameterless constructor.
Stack trace