mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -04:00
Add logging of URL being processed when logging an error
This might help diagnosing stuff like "Operation was cancelled"
This commit is contained in:
parent
0cd7cd611e
commit
71d8e66d9f
@ -3,6 +3,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
@ -239,19 +240,22 @@ 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)
|
||||||
{
|
{
|
||||||
|
string urlSuffix = string.IsNullOrWhiteSpace(urlToLog)
|
||||||
|
? string.Format(CultureInfo.InvariantCulture, "; URL being processed: {0}", urlToLog)
|
||||||
|
: "";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ex = GetActualException(ex);
|
ex = GetActualException(ex);
|
||||||
|
|
||||||
if (logExceptionStackTrace)
|
if (logExceptionStackTrace)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error processing request");
|
_logger.LogError(ex, "Error processing request{Suffix}", urlSuffix);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogError("Error processing request: {Message}", ex.Message);
|
_logger.LogError("Error processing request: {Message}{Suffix}", ex.Message, urlSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
var httpRes = httpReq.Response;
|
var httpRes = httpReq.Response;
|
||||||
@ -271,7 +275,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
}
|
}
|
||||||
catch (Exception errorEx)
|
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){Suffix}", urlSuffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +557,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
|| ex is OperationCanceledException
|
|| ex is OperationCanceledException
|
||||||
|| ex is SecurityException
|
|| ex is SecurityException
|
||||||
|| ex is FileNotFoundException;
|
|| ex is FileNotFoundException;
|
||||||
await ErrorHandler(ex, httpReq, ignoreStackTrace).ConfigureAwait(false);
|
await ErrorHandler(ex, httpReq, ignoreStackTrace, urlToLog).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user