I have ASP.NET Core 2.1 app in Pivotal Cloud Foundry where we want to be able to configure logging levels on fly. As logger provider we are using Serilog. Is it possible that Steeltoe Dynamic Logging works properly with 3rd party loggers and how?
Here is what I tried:
In Program.cs:
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseCloudFoundryHosting()
.ConfigureLogging((builderContext, loggingBuilder) =>
{
loggingBuilder.AddDynamicConsole();
})
.UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration
.ReadFrom.Configuration(hostingContext.Configuration))
.UseStartup<Startup>();
In appsettings.json
"Serilog": {
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext}: {Properties} {NewLine} {EventId} {Message:lj}{NewLine}{Exception}"
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
}
In appsettings.Development.json:
"Logging": {
"LogLevel": {
"Default": "Debug"
}
}
And I get only this in Configure Logging Levels: Configure logging levels screenshot
What am I doing wrong?