diff options
| author | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-04-13 17:06:24 -0400 |
|---|---|---|
| committer | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-04-13 17:06:24 -0400 |
| commit | 9728aa8b0abc7785f8c9f3d62c2adff1920cfab9 (patch) | |
| tree | 111975663193ef2dfab67380e6d5a2f4f9d554f6 /Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | |
| parent | 17e8813378c2fe1a83d1eddb829dae68f8c71bfe (diff) | |
| parent | 9a0a4575adbba04b6b7f3294e70175a98b864a90 (diff) | |
Merge branch 'master' into register-services-correctly
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/HttpListenerHost.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 72667a314..5ae65a4e3 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -239,7 +239,7 @@ namespace Emby.Server.Implementations.HttpServer } } - private async Task ErrorHandler(Exception ex, IRequest httpReq, bool logExceptionStackTrace) + private async Task ErrorHandler(Exception ex, IRequest httpReq, bool logExceptionStackTrace, string urlToLog) { try { @@ -247,11 +247,11 @@ namespace Emby.Server.Implementations.HttpServer if (logExceptionStackTrace) { - _logger.LogError(ex, "Error processing request"); + _logger.LogError(ex, "Error processing request. URL: {Url}", urlToLog); } else { - _logger.LogError("Error processing request: {Message}", ex.Message); + _logger.LogError("Error processing request: {Message}. URL: {Url}", ex.Message.TrimEnd('.'), urlToLog); } var httpRes = httpReq.Response; @@ -271,7 +271,7 @@ namespace Emby.Server.Implementations.HttpServer } catch (Exception errorEx) { - _logger.LogError(errorEx, "Error this.ProcessRequest(context)(Exception while writing error to the response)"); + _logger.LogError(errorEx, "Error this.ProcessRequest(context)(Exception while writing error to the response). URL: {Url}", urlToLog); } } @@ -456,7 +456,7 @@ namespace Emby.Server.Implementations.HttpServer var stopWatch = new Stopwatch(); stopWatch.Start(); var httpRes = httpReq.Response; - string urlToLog = null; + string urlToLog = GetUrlToLog(urlString); string remoteIp = httpReq.RemoteIp; try @@ -502,8 +502,6 @@ namespace Emby.Server.Implementations.HttpServer return; } - urlToLog = GetUrlToLog(urlString); - if (string.Equals(localPath, _baseUrlPrefix + "/", StringComparison.OrdinalIgnoreCase) || string.Equals(localPath, _baseUrlPrefix, StringComparison.OrdinalIgnoreCase) || string.Equals(localPath, "/", StringComparison.OrdinalIgnoreCase) @@ -553,7 +551,7 @@ namespace Emby.Server.Implementations.HttpServer || ex is OperationCanceledException || ex is SecurityException || ex is FileNotFoundException; - await ErrorHandler(ex, httpReq, ignoreStackTrace).ConfigureAwait(false); + await ErrorHandler(ex, httpReq, !ignoreStackTrace, urlToLog).ConfigureAwait(false); } finally { |
