diff --git a/NzbDrone.Core/Instrumentation/ExceptioneerTarget.cs b/NzbDrone.Core/Instrumentation/ExceptioneerTarget.cs index 8fac9e123..2cd8caf76 100644 --- a/NzbDrone.Core/Instrumentation/ExceptioneerTarget.cs +++ b/NzbDrone.Core/Instrumentation/ExceptioneerTarget.cs @@ -8,15 +8,14 @@ namespace NzbDrone.Core.Instrumentation { public class ExceptioneerTarget : Target { + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + protected override void Write(LogEventInfo logEvent) { - if (logEvent.Exception == null) - throw new InvalidOperationException( - @"Missing Exception Object.. Please Use Logger.FatalException() or Logger.ErrorException() rather - than Logger.Fatal() and Logger.Error()"); - if (!Debugger.IsAttached) { + Logger.Trace("Sending Exception to Exceptioneer"); + new Client { ApiKey = "43BBF60A-EB2A-4C1C-B09E-422ADF637265", diff --git a/NzbDrone.Core/Instrumentation/LogConfiguration.cs b/NzbDrone.Core/Instrumentation/LogConfiguration.cs index eb56f2e8d..4e93694c2 100644 --- a/NzbDrone.Core/Instrumentation/LogConfiguration.cs +++ b/NzbDrone.Core/Instrumentation/LogConfiguration.cs @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Instrumentation public static void StartDbLogging() { -#if Release +#if RELEASE var exTarget = new ExceptioneerTarget(); LogManager.Configuration.AddTarget("Exceptioneer", exTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Error, exTarget)); diff --git a/NzbDrone.Web/Views/Shared/_Layout.cshtml b/NzbDrone.Web/Views/Shared/_Layout.cshtml index 9bb2f830f..efbd8570e 100644 --- a/NzbDrone.Web/Views/Shared/_Layout.cshtml +++ b/NzbDrone.Web/Views/Shared/_Layout.cshtml @@ -1,4 +1,4 @@ - + @using Helpers; @@ -61,7 +61,7 @@ background notification @(Html.Telerik().ScriptRegistrar().jQuery(false)) - + @RenderSection("Scripts", required: false) diff --git a/NzbDrone/IISController.cs b/NzbDrone/IISController.cs index 1d93b86ee..06d4bc99e 100644 --- a/NzbDrone/IISController.cs +++ b/NzbDrone/IISController.cs @@ -71,8 +71,6 @@ namespace NzbDrone IISProcess.BeginErrorReadLine(); IISProcess.BeginOutputReadLine(); - IISProcess.PriorityClass = ProcessPriorityClass.AboveNormal; - //Start Ping _pingTimer = new Timer(300000) { AutoReset = true }; _pingTimer.Elapsed += (PingServer); diff --git a/NzbDrone/Program.cs b/NzbDrone/Program.cs index 72a9ea644..6138e05f5 100644 --- a/NzbDrone/Program.cs +++ b/NzbDrone/Program.cs @@ -12,21 +12,25 @@ namespace NzbDrone private static void Main() { - Logger.Info(Process.GetCurrentProcess().Id); - try { + Config.ConfigureNlog(); + Logger.Info("Starting NZBDrone. Start-up Path:'{0}'", Config.ProjectRoot); Thread.CurrentThread.Name = "Host"; + Process currentProcess = Process.GetCurrentProcess(); + if (currentProcess.PriorityClass < ProcessPriorityClass.Normal) + { + Logger.Info("Promoting process priority from {0} to {1}", currentProcess.PriorityClass, ProcessPriorityClass.Normal); + currentProcess.PriorityClass = ProcessPriorityClass.Normal; + } + + currentProcess.EnableRaisingEvents = true; + currentProcess.Exited += ProgramExited; + AppDomain.CurrentDomain.UnhandledException += ((s, e) => AppDomainException(e)); AppDomain.CurrentDomain.ProcessExit += ProgramExited; AppDomain.CurrentDomain.DomainUnload += ProgramExited; - Process.GetCurrentProcess().EnableRaisingEvents = true; - Process.GetCurrentProcess().Exited += ProgramExited; - - Config.ConfigureNlog(); - - Logger.Info("Starting NZBDrone. Start-up Path:'{0}'", Config.ProjectRoot); IISController.StopServer(); IISController.StartServer();