update logging

This commit is contained in:
Luke Pulverenti 2016-12-26 12:38:12 -05:00
parent 5765b51680
commit 325066f7ed
7 changed files with 27 additions and 7 deletions

View File

@ -795,6 +795,8 @@ return null;
/// </summary> /// </summary>
public void NotifyPendingRestart() public void NotifyPendingRestart()
{ {
Logger.Info("App needs to be restarted.");
var changed = !HasPendingRestart; var changed = !HasPendingRestart;
HasPendingRestart = true; HasPendingRestart = true;

View File

@ -1083,6 +1083,8 @@ namespace Emby.Server.Core
if (requiresRestart) if (requiresRestart)
{ {
Logger.Info("App needs to be restarted due to configuration change.");
NotifyPendingRestart(); NotifyPendingRestart();
} }
} }
@ -1204,7 +1206,8 @@ namespace Emby.Server.Core
var exclude = new[] var exclude = new[]
{ {
"mbplus.dll", "mbplus.dll",
"mbintros.dll" "mbintros.dll",
"embytv.dll"
}; };
return !exclude.Contains(filename ?? string.Empty, StringComparer.OrdinalIgnoreCase); return !exclude.Contains(filename ?? string.Empty, StringComparer.OrdinalIgnoreCase);

View File

@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPoints
if (_appHost.HasPendingRestart) 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(); DisposeTimer();
_logger.Info("Automatically restarting the system because it is idle and a restart is required.");
try try
{ {
_appHost.Restart(); _appHost.Restart();

View File

@ -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 try
{
if (logException)
{ {
_logger.ErrorException("Error processing request", ex); _logger.ErrorException("Error processing request", ex);
}
var httpRes = httpReq.Response; var httpRes = httpReq.Response;
@ -529,6 +532,10 @@ namespace Emby.Server.Implementations.HttpServer
ErrorHandler(new FileNotFoundException(), httpReq); ErrorHandler(new FileNotFoundException(), httpReq);
} }
} }
catch (OperationCanceledException ex)
{
ErrorHandler(ex, httpReq, false);
}
catch (Exception ex) catch (Exception ex)
{ {
ErrorHandler(ex, httpReq); ErrorHandler(ex, httpReq);

View File

@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.HttpServer
/// Gets or sets the error handler. /// Gets or sets the error handler.
/// </summary> /// </summary>
/// <value>The error handler.</value> /// <value>The error handler.</value>
Action<Exception, IRequest> ErrorHandler { get; set; } Action<Exception, IRequest, bool> ErrorHandler { get; set; }
/// <summary> /// <summary>
/// Gets or sets the request handler. /// Gets or sets the request handler.

View File

@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
_httpRequestFactory = httpRequestFactory; _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 Func<IHttpRequest, Uri, Task> RequestHandler { get; set; }
public Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; } public Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; }
@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
_logger.ErrorException("Error processing request", ex); _logger.ErrorException("Error processing request", ex);
httpReq = httpReq ?? GetRequest(context); httpReq = httpReq ?? GetRequest(context);
ErrorHandler(ex, httpReq); ErrorHandler(ex, httpReq, true);
return Task.FromResult(true); return Task.FromResult(true);
} }

View File

@ -87,6 +87,12 @@ namespace MediaBrowser.Providers.TV
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
// Doesn't have required provider id's
if (string.IsNullOrWhiteSpace(seriesDataPath))
{
return;
}
var episodeFiles = _fileSystem.GetFilePaths(seriesDataPath) var episodeFiles = _fileSystem.GetFilePaths(seriesDataPath)
.Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase)) .Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase))
.Select(Path.GetFileNameWithoutExtension) .Select(Path.GetFileNameWithoutExtension)