Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/NLog.Web.AspNetCore/AspNetExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
11 changes: 6 additions & 5 deletions src/Shared/LayoutRenderers/AspNetUserClaimLayoutRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent)
}
}

#if NET46
#if !ASP_NET_CORE
private static IEnumerable<KeyValuePair<string, string>> GetAllClaims(System.Security.Principal.IPrincipal claimsPrincipal)
{
return GetAllClaims(claimsPrincipal as ClaimsPrincipal);
Expand All @@ -91,16 +91,17 @@ private static IEnumerable<KeyValuePair<string, string>> GetAllClaims(ClaimsPrin
new KeyValuePair<string, string>(claim.Type, claim.Value)) ??
System.Linq.Enumerable.Empty<KeyValuePair<string, string>>();
}
#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
;
}
Expand Down