Re-use any existing ReloadableLogger
It's possible that consumers have already set up a bootstrap logger themselves before Umbraco had a chance too, if that's the case we just reload it.
(cherry picked from commit 7ad1e638e6)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
ea3c862228
commit
57a29e4085
@@ -96,11 +96,18 @@ public static class ServiceCollectionExtensions
|
||||
// Bootstrap logger setup
|
||||
///////////////////////////////////////////////
|
||||
|
||||
LoggerConfiguration serilogConfig = new LoggerConfiguration()
|
||||
Func<LoggerConfiguration, LoggerConfiguration> serilogConfig = cfg => cfg
|
||||
.MinimalConfiguration(hostEnvironment, loggingConfig, umbracoFileConfiguration)
|
||||
.ReadFrom.Configuration(configuration);
|
||||
|
||||
Log.Logger = serilogConfig.CreateBootstrapLogger();
|
||||
if (Log.Logger is ReloadableLogger reloadableLogger)
|
||||
{
|
||||
reloadableLogger.Reload(serilogConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Logger = serilogConfig(new LoggerConfiguration()).CreateBootstrapLogger();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Runtime logger setup
|
||||
|
||||
Reference in New Issue
Block a user