diff --git a/source/Core/Configuration/Hosting/ErrorPageFilterAttribute.cs b/source/Core/Configuration/Hosting/ErrorPageFilterAttribute.cs index 3c87127ea..3dc9ebc92 100644 --- a/source/Core/Configuration/Hosting/ErrorPageFilterAttribute.cs +++ b/source/Core/Configuration/Hosting/ErrorPageFilterAttribute.cs @@ -31,8 +31,6 @@ internal class ErrorPageFilterAttribute : ExceptionFilterAttribute public override async System.Threading.Tasks.Task OnExceptionAsync(HttpActionExecutedContext actionExecutedContext, System.Threading.CancellationToken cancellationToken) { - Logger.ErrorException("Exception accessing: " + actionExecutedContext.Request.RequestUri.AbsolutePath, actionExecutedContext.Exception); - var env = actionExecutedContext.ActionContext.Request.GetOwinEnvironment(); var options = env.ResolveDependency(); var viewSvc = env.ResolveDependency(); diff --git a/source/Core/Configuration/Hosting/LogProviderExceptionLogger.cs b/source/Core/Configuration/Hosting/LogProviderExceptionLogger.cs index 17d18a139..26e98f48e 100644 --- a/source/Core/Configuration/Hosting/LogProviderExceptionLogger.cs +++ b/source/Core/Configuration/Hosting/LogProviderExceptionLogger.cs @@ -30,7 +30,15 @@ internal class LogProviderExceptionLogger : IExceptionLogger public async Task LogAsync(ExceptionLoggerContext context, CancellationToken cancellationToken) { - Logger.ErrorException("Unhandled exception", context.Exception); + if(context.Request != null) + { + var mesage = string.Format("Unhandled exception accessing: {0}", context.Request.RequestUri.AbsolutePath); + Logger.ErrorException(mesage, context.Exception); + } + else + { + Logger.ErrorException("Unhandled exception", context.Exception); + } var env = context.Request.GetOwinEnvironment(); var events = env.ResolveDependency();