diff --git a/src/NLog.Web.AspNetCore/AspNetExtensions.cs b/src/NLog.Web.AspNetCore/AspNetExtensions.cs
index 2479d020..72347292 100644
--- a/src/NLog.Web.AspNetCore/AspNetExtensions.cs
+++ b/src/NLog.Web.AspNetCore/AspNetExtensions.cs
@@ -105,6 +105,30 @@ public static LogFactory ConfigureNLog(this ILoggingBuilder builder, LoggingConf
return LogManager.LogFactory;
}
+ ///
+ /// Apply NLog configuration from XML config.
+ ///
+ /// The logging builder
+ /// Path to NLog configuration file, e.g. nlog.config.
+ public static ILoggingBuilder AddNLog(this ILoggingBuilder builder, string configFileName)
+ {
+ ConfigureServicesNLog(null, builder.Services, serviceProvider => serviceProvider.GetService());
+ LogManager.LoadConfiguration(configFileName);
+ return builder;
+ }
+
+ ///
+ /// Configure NLog from API
+ ///
+ /// The logging builder
+ /// Config for NLog
+ public static ILoggingBuilder AddNLog(this ILoggingBuilder builder, LoggingConfiguration configuration)
+ {
+ ConfigureServicesNLog(null, builder.Services, serviceProvider => serviceProvider.GetService());
+ LogManager.Configuration = configuration;
+ return builder;
+ }
+
///
/// Use NLog for Dependency Injected loggers.
///