mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 05:18:27 +01:00
update logging
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
|
||||
if (_appHost.HasPendingRestart)
|
||||
{
|
||||
_timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
|
||||
_timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
DisposeTimer();
|
||||
|
||||
_logger.Info("Automatically restarting the system because it is idle and a restart is required.");
|
||||
|
||||
try
|
||||
{
|
||||
_appHost.Restart();
|
||||
|
||||
@@ -228,11 +228,14 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
}
|
||||
}
|
||||
|
||||
private void ErrorHandler(Exception ex, IRequest httpReq)
|
||||
private void ErrorHandler(Exception ex, IRequest httpReq, bool logException = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.ErrorException("Error processing request", ex);
|
||||
if (logException)
|
||||
{
|
||||
_logger.ErrorException("Error processing request", ex);
|
||||
}
|
||||
|
||||
var httpRes = httpReq.Response;
|
||||
|
||||
@@ -529,6 +532,10 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
ErrorHandler(new FileNotFoundException(), httpReq);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException ex)
|
||||
{
|
||||
ErrorHandler(ex, httpReq, false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorHandler(ex, httpReq);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
/// Gets or sets the error handler.
|
||||
/// </summary>
|
||||
/// <value>The error handler.</value>
|
||||
Action<Exception, IRequest> ErrorHandler { get; set; }
|
||||
Action<Exception, IRequest, bool> ErrorHandler { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the request handler.
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
|
||||
_httpRequestFactory = httpRequestFactory;
|
||||
}
|
||||
|
||||
public Action<Exception, IRequest> ErrorHandler { get; set; }
|
||||
public Action<Exception, IRequest, bool> ErrorHandler { get; set; }
|
||||
public Func<IHttpRequest, Uri, Task> RequestHandler { get; set; }
|
||||
|
||||
public Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; }
|
||||
@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
|
||||
_logger.ErrorException("Error processing request", ex);
|
||||
|
||||
httpReq = httpReq ?? GetRequest(context);
|
||||
ErrorHandler(ex, httpReq);
|
||||
ErrorHandler(ex, httpReq, true);
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user