diff --git a/src/NLog.Web.AspNetCore/AspNetExtensions.cs b/src/NLog.Web.AspNetCore/AspNetExtensions.cs index 95e15cbf..b25b5352 100644 --- a/src/NLog.Web.AspNetCore/AspNetExtensions.cs +++ b/src/NLog.Web.AspNetCore/AspNetExtensions.cs @@ -446,13 +446,6 @@ private static string ResolveEnvironmentNLogConfigFile(string basePath, string e return null; } - private static LoggingConfiguration LoadXmlLoggingConfigurationFromPath(string contentRootPath, string nlogConfigFileName, LogFactory logFactory) - { - var standardPath = System.IO.Path.Combine(contentRootPath, nlogConfigFileName); - return System.IO.File.Exists(standardPath) ? - new XmlLoggingConfiguration(standardPath, logFactory) : null; - } - private static bool IsLoggingConfigurationLoaded(LoggingConfiguration cfg) { return cfg?.LoggingRules?.Count > 0 && cfg?.AllTargets?.Count > 0; diff --git a/src/Shared/LayoutRenderers/AspNetResponseHasStartedLayoutRenderer.cs b/src/Shared/LayoutRenderers/AspNetResponseHasStartedLayoutRenderer.cs index e489acf1..f69bf39c 100644 --- a/src/Shared/LayoutRenderers/AspNetResponseHasStartedLayoutRenderer.cs +++ b/src/Shared/LayoutRenderers/AspNetResponseHasStartedLayoutRenderer.cs @@ -20,7 +20,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) var response = HttpContextAccessor.HttpContext.TryGetResponse(); #if ASP_NET_CORE builder.Append(response?.HasStarted == true ? '1' : '0'); -#elif NET46 +#elif NET46_OR_GREATER builder.Append(response?.HeadersWritten == true ? '1' : '0'); #endif } diff --git a/src/Shared/LayoutRenderers/AspNetUserClaimLayoutRenderer.cs b/src/Shared/LayoutRenderers/AspNetUserClaimLayoutRenderer.cs index 861ddf92..68d2f64e 100644 --- a/src/Shared/LayoutRenderers/AspNetUserClaimLayoutRenderer.cs +++ b/src/Shared/LayoutRenderers/AspNetUserClaimLayoutRenderer.cs @@ -79,7 +79,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) } } -#if NET46 +#if !ASP_NET_CORE private static IEnumerable> GetAllClaims(System.Security.Principal.IPrincipal claimsPrincipal) { return GetAllClaims(claimsPrincipal as ClaimsPrincipal); @@ -91,16 +91,17 @@ private static IEnumerable> GetAllClaims(ClaimsPrin new KeyValuePair(claim.Type, claim.Value)) ?? System.Linq.Enumerable.Empty>(); } -#if NET46 - private static Claim GetClaim(System.Security.Principal.IPrincipal claimsPrincipal, string claimType) -#else + +#if ASP_NET_CORE private static Claim GetClaim(ClaimsPrincipal claimsPrincipal, string claimType) +#else + private static Claim GetClaim(System.Security.Principal.IPrincipal claimsPrincipal, string claimType) #endif { var claimsIdentity = claimsPrincipal.Identity as ClaimsIdentity; // Prioritize primary identity return claimsIdentity?.FindFirst(claimType) #if ASP_NET_CORE - ?? claimsPrincipal.FindFirst(claimType) + ?? claimsPrincipal.FindFirst(claimType) #endif ; }