Browse Source

update logging

Luke Pulverenti 8 năm trước cách đây
mục cha
commit
325066f7ed

+ 2 - 0
Emby.Common.Implementations/BaseApplicationHost.cs

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

+ 4 - 1
Emby.Server.Core/ApplicationHost.cs

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

+ 3 - 1
Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs

@@ -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();

+ 9 - 2
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -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);

+ 1 - 1
Emby.Server.Implementations/HttpServer/IHttpListener.cs

@@ -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.

+ 2 - 2
Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs

@@ -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);
             }
 

+ 6 - 0
MediaBrowser.Providers/TV/MissingEpisodeProvider.cs

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