Description
I am trying to log before the app is running, by using the CreateBootstrapLogger, but it looks like the configurations are not applied from appsettings.json.
There are 2 sinks provided: Serilog.Sinks.Console and Serilog.Sinks.Seq, but the logs are nowhere to be found. The .ReadFrom.Configuration() has no effect at all, and the configuration is not null. Using .WriteTo.Console(), or .WriteTo.Seq() takes effect, so there must be something going on with the .ReadFrom.Configuration() method.
Bootstrap logger:
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(builder.Configuration.GetSection("Serilog"))
.CreateBootstrapLogger();
Log.Information("Test information"); // this isn't logged
After build, the logs work as expected, and configuration from appsettings.json is applied. This is the default Serilog setup:
Hello!
Description I am trying to log before the app is running, by using the
CreateBootstrapLogger
, but it looks like the configurations are not applied fromappsettings.json
.There are 2 sinks provided:
Serilog.Sinks.Console
andSerilog.Sinks.Seq
, but the logs are nowhere to be found. The.ReadFrom.Configuration()
has no effect at all, and the configuration is notnull
. Using.WriteTo.Console()
, or.WriteTo.Seq()
takes effect, so there must be something going on with the.ReadFrom.Configuration()
method.Bootstrap logger:
After build, the logs work as expected, and configuration from
appsettings.json
is applied. This is the default Serilog setup:Just to have erything here, the following is the configuration:
Expected behavior Asp.Net logs should work with Bootstrap logger
Relevant package, tooling and runtime versions Serilog.AspNetCore: 8.0.2 Serilog.Sinks.Seq: 8.0.0