Skip to content

Commit

Permalink
Merge pull request #202 from 304NotModified/fix-callsite-aspnetcore2
Browse files Browse the repository at this point in the history
Fix ${callsite} in Asp.net core 2
  • Loading branch information
304NotModified authored Oct 13, 2017
2 parents a855ff2 + 4a988ad commit 164c832
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion NLog.Web.AspNetCore/AspNetExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private static LoggingConfiguration ConfigureNLog(string fileName)
/// <returns>LogFactory to get loggers, add events etc</returns>
public static LogFactory ConfigureNLog(this ILoggingBuilder builder, string configFileName)
{
return NLogBuilder.ConfigureNLog(configFileName);
return builder.ConfigureNLog(new XmlLoggingConfiguration(configFileName));
}

/// <summary>
Expand All @@ -85,6 +85,9 @@ public static LogFactory ConfigureNLog(this ILoggingBuilder builder, string conf
/// <returns>LogFactory to get loggers, add events etc</returns>
public static LogFactory ConfigureNLog(this ILoggingBuilder builder, LoggingConfiguration configuration)
{
//ConfigureHiddenAssemblies
//todo rename there to ConfigureNLog?
builder.AddNLog();
return NLogBuilder.ConfigureNLog(configuration);
}

Expand Down
8 changes: 8 additions & 0 deletions NLog.Web.AspNetCore/NLogBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ internal static void RegisterNLogWebAspNetCore()
{
InternalLogger.Error(ex, "Registering NLog.Web.AspNetCore failed");
}
try
{
LogManager.AddHiddenAssembly(typeof(NLogBuilder).GetTypeInfo().Assembly);
}
catch (Exception ex)
{
InternalLogger.Warn(ex, "Hidding assembly of {0} failed", nameof(NLogBuilder));
}

}

Expand Down

0 comments on commit 164c832

Please sign in to comment.