Closed alastairtree closed 6 years ago
@alastairtree there is a working version of this in #92.
What you have above seems correct. Make sure that your appsetting.json
is available
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger();
{
"Serilog": {
"Using": ["Serilog.Sinks.Console", "Serilog.Sinks.Splunk"],
"MinimumLevel": "Information",
"WriteTo": [{
"Name": "Console"
},
{
"Name": "EventCollector",
"Args": {
"splunkHost": "http://splunk:8088",
"eventCollectorToken": "00112233-4455-6677-8899-AABBCCDDEEFF"
}
}
],
"Properties": {
"Application": "Serilog Splunk Console Sample",
"Serilog.Sinks.Splunk.Sample": "ViaEventCollector",
"Serilog.Sinks.Splunk.Sample.TestType": "AppSettings.json"
}
}
}
Hello - thanks for the library.
I was wondering if you support reading the sink config from the configuration files using Serilog.Settings.Configuration? I can't seem to get the code below to add the sink? Am I doing it wrong or is it not supported? Or could you point me to some docs?
appsettings.json
program.cs