aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2020-04-12 18:07:30 -0400
committerGitHub <noreply@github.com>2020-04-12 18:07:30 -0400
commit2be6550db4afabc48f7c5122b0eed577db9a9a2e (patch)
tree4f822b60f50cb1293c6ed97c722b46f2151ba96a /Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
parent6d98c0b62ad86c8708345303ecba7d7852aaf725 (diff)
parent3bdb5e80a53fe8148048fc4424b1e92adc62ac3d (diff)
Merge pull request #2783 from JustAMan/better-cancel-msg
Add logging of URL being processed when logging an error
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/HttpListenerHost.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs14
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
{