Serilog doesn't get Seq configuration from configuration file
I'm reading serilog and seq configuration from this configuration file.
{
"clientId": "...",
"secret": "...",
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.AspNetCore.Authentication": "Information",
"System": "Warning",
"Hangfire": "Information"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "//tmp//infinitys//logs//qms//log-.txt",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}",
"rollingInterval": "Day",
"retainedFileCountLimit": 7
}
},
{
"Name": "Seq",
"Args": {
"serverUrl": "http://seq:5341"
}
}
],
"Enrich": [
"WithMachineName",
]
}
}
When i try to set up my logger, It seems that the Seq part is not being read, only the rollign file part is working.
var logger = new LoggerConfiguration().ReadFrom.Configuration(config)
.CreateLogger();
If I manually add the seq configuration like this it works:
var logger = new LoggerConfiguration().ReadFrom.Configuration(config)
.WriteTo.Seq("http://localhost:5341").Enrich.WithMachineName().Enrich.WithProperty("ClientId:", config.GetSection("clientId").Value)
.CreateLogger();
problem is I need to have different configuration with different environments.
Am I missing something in the config file?
Comments
Post a Comment