-
Notifications
You must be signed in to change notification settings - Fork 131
Description
For an AOT-published application on .NET 8, I have the following configuration (in the Microsoft.Extensions.Configuration sense):
{
"Serilog": {
"MinimumLevel": "Debug"
}
}
…and the rest of the Serilog configuration is done in C# code. I would like be able to change this log level at runtime. However, Serilog.Settings.Configuration fails at runtime when the only assembly to search is "Serilog". Because of how that is done, the following expected workarounds do not solve the problem:
{
"Serilog": {
"Using": [],
"MinimumLevel": "Debug"
}
}
{
"Serilog": {
"Using": null,
"MinimumLevel": "Debug"
}
}
{
"Serilog": {
"Using": ["Serilog"],
"MinimumLevel": "Debug"
}
}
All of which fail at runtime with the same error message: "No Serilog:Using configuration section is defined and no Serilog assemblies were found. This is most likely because the application is published as single-file." and so on.
In order to continue testing AOT publication, I have to configure like this:
{
"Serilog": {
"Using": ["<name of entry assembly>"],
"MinimumLevel": "Debug"
}
}
…but this is undesirable since we'd have to put the name of the entry assembly in the configuration for each application. Is there or can there be a way to give Serilog.Settings.Configuration a positive signal that the single assembly it found is OK?