Pass configuration section to LoggerFactory
This commit is contained in:
parent
1ae1ff01a3
commit
ad1d0cc67d
|
|
@ -267,7 +267,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||||
hostingContext.Configuration = configuration;
|
hostingContext.Configuration = configuration;
|
||||||
|
|
||||||
// The configured ILoggerFactory is added as a singleton here. AddLogging below will not add an additional one.
|
// The configured ILoggerFactory is added as a singleton here. AddLogging below will not add an additional one.
|
||||||
var loggerFactory = _createLoggerFactoryDelegate?.Invoke(hostingContext) ?? new LoggerFactory();
|
var loggerFactory = _createLoggerFactoryDelegate?.Invoke(hostingContext) ?? new LoggerFactory(configuration.GetSection("Logging"));
|
||||||
services.AddSingleton(loggerFactory);
|
services.AddSingleton(loggerFactory);
|
||||||
hostingContext.LoggerFactory = loggerFactory;
|
hostingContext.LoggerFactory = loggerFactory;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue