Configuring sink via LoggerConfiguration.ReadFrom.Configuration()
See original GitHub issueI’m probably doing something wrong here, but I cannot get Http sink to work when configuring via the appSettings route. Maybe this is simply not supported?
Step 1: Describe your environment
.NET Core
Step 2: Describe the problem
Steps to reproduce:
- Configure sink via
IConfigurationRoot
"Serilog": {
"MinimumLevel": "Debug",
"Using": [ "Serilog.Sinks.Http" ],
"WriteTo": [
{
"Name": "Http",
"Args": { "requestUri": "http://127.0.0.1:38421/" }
}
}
- Feed above config to
(new LoggerConfiguration().ReadFrom.Configuration(...))
- Run
Observed results
- The Http sink is not present in the sinks collection and I receive no sort of error to troubleshoot
- Same configuration and code works with other sinks such as LiterateConsole
- The Http sink DOES work if I configure it via
.WriteTo.Http(...)
but we need per-environment configuration and would like it to work as other sinks
Expected results
- Expected configuration above to result in a
Serilog.Core.Logger
instance with an Http sink instance in the_sinks
property.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Example of configuring this sink via LoggerConfiguration ...
ReadFrom.Configuration(config) and appsettings.json when in an ASP.NET Core environment with Visual Studio 2017? Something like this (for ...
Read more >Customize Serilog configuration after ReadFrom. ...
I want to customize some configuration options before actually applying them. For instance, in Elasticsearch Sink some options are of type Func< ...
Read more >Serilog logging with .Net Core — Are we configuring it correctly?
Configure the settings for Serilog through the config file. "Serilog": { ... var logger = new LoggerConfiguration().ReadFrom.Configuration(builder.
Read more >Serilog logging setup & configuration example
Step 3 - Using Serilog. Create a statically accessible Logger configured from AppSettings. Copy Log.Logger = new LoggerConfiguration() .ReadFrom.
Read more >Reading logger configuration from appsettings.json
With the new Serilog.Settings.Configuration package, ReadFrom.Configuration() lets us pull the same information from appsettings.json .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nblumhardt you are correct, I got it wrong when describing it as a PR. Your proposed solution is a good one, I will try it out.
I think the initiative of having an alternative solution to the problem is a dead fish in the water. I’ll close the issue.
@FantasticFiasco the issue you’ve linked is not a PR; I don’t think there is likely to be movement on it for a while as we don’t yet have a proposed design, nor any further feedback. Would implementing a specific extension method here, but marking it
[EditorBrowsable(EditorBrowsableState.Hidden)]
be a good workaround that doesn’t pollute IntelliSense? Cheers!