From d3471b5bbbbe99355fe767ac53a4175713ae276b Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 24 Apr 2011 20:51:18 -0700 Subject: [PATCH 1/3] Downgraded some logs --- .gitignore | 3 +- NzbDrone.Core/Providers/Jobs/JobProvider.cs | 15 ++++------ NzbDrone/IISController.cs | 32 +++++++++++++++++---- NzbDrone/NzbDrone.csproj | 2 +- NzbDrone/Program.cs | 1 + 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 10fe732d4..5cbd6a1a1 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,5 @@ _ReSharper*/ [Ll]ogs/ /[Pp]ackage/ #NZBDrone specific -*.db \ No newline at end of file +*.db +*Web.Publish.xml \ No newline at end of file diff --git a/NzbDrone.Core/Providers/Jobs/JobProvider.cs b/NzbDrone.Core/Providers/Jobs/JobProvider.cs index 0828dc1c4..e07fc21fc 100644 --- a/NzbDrone.Core/Providers/Jobs/JobProvider.cs +++ b/NzbDrone.Core/Providers/Jobs/JobProvider.cs @@ -70,7 +70,7 @@ namespace NzbDrone.Core.Providers.Jobs { if (_isRunning) { - Logger.Info("Another instance of this job is already running. Ignoring request."); + Logger.Warn("Another instance of this job is already running. Ignoring request."); return false; } _isRunning = true; @@ -78,7 +78,6 @@ namespace NzbDrone.Core.Providers.Jobs try { - Logger.Trace("Getting list of jobs needing to be executed"); var pendingJobs = All().Where( t => t.Enable && @@ -114,16 +113,14 @@ namespace NzbDrone.Core.Providers.Jobs { if (_isRunning) { - Logger.Info("Another instance of this job is already running. Ignoring request."); + Logger.Warn("Another job is already running. Ignoring request."); return false; } _isRunning = true; } - - Logger.Info("User has requested a manual execution of {0}", jobType.Name); if (_jobThread == null || !_jobThread.IsAlive) { - Logger.Debug("Initializing background thread"); + Logger.Trace("Initializing background thread"); ThreadStart starter = () => { @@ -170,7 +167,7 @@ namespace NzbDrone.Core.Providers.Jobs { try { - Logger.Info("Starting job '{0}'. Last execution {1}", settings.Name, settings.LastExecution); + Logger.Debug("Starting job '{0}'. Last execution {1}", settings.Name, settings.LastExecution); settings.LastExecution = DateTime.Now; var sw = Stopwatch.StartNew(); @@ -180,7 +177,7 @@ namespace NzbDrone.Core.Providers.Jobs settings.Success = true; sw.Stop(); - Logger.Info("Job '{0}' successfully completed in {1} seconds", timerClass.Name, sw.Elapsed.Minutes, + Logger.Debug("Job '{0}' successfully completed in {1} seconds", timerClass.Name, sw.Elapsed.Minutes, sw.Elapsed.Seconds); } catch (Exception e) @@ -201,7 +198,7 @@ namespace NzbDrone.Core.Providers.Jobs /// public virtual void Initialize() { - Logger.Info("Initializing jobs. Count {0}", _jobs.Count()); + Logger.Debug("Initializing jobs. Count {0}", _jobs.Count()); var currentTimer = All(); foreach (var timer in _jobs) diff --git a/NzbDrone/IISController.cs b/NzbDrone/IISController.cs index 7b23f4c98..d0565bb9e 100644 --- a/NzbDrone/IISController.cs +++ b/NzbDrone/IISController.cs @@ -44,7 +44,8 @@ namespace NzbDrone IISProcess.StartInfo.CreateNoWindow = true; - IISProcess.OutputDataReceived += (OnDataReceived); + IISProcess.OutputDataReceived += (OnOutputDataReceived); + IISProcess.ErrorDataReceived += (OnErrorDataReceived); //Set Variables for the config file. Environment.SetEnvironmentVariable("NZBDRONE_PATH", Config.ProjectRoot); @@ -60,6 +61,9 @@ namespace NzbDrone Logger.Info("Starting process. [{0}]", IISProcess.StartInfo.FileName); + + + IISProcess.Start(); IISProcess.BeginErrorReadLine(); @@ -73,6 +77,14 @@ namespace NzbDrone return IISProcess; } + private static void OnErrorDataReceived(object sender, DataReceivedEventArgs e) + { + if (e == null || String.IsNullOrWhiteSpace(e.Data)) + return; + + IISLogger.Error(e.Data); + } + internal static void StopServer() { KillProcess(IISProcess); @@ -82,7 +94,7 @@ namespace NzbDrone { string processPath = process.MainModule.FileName; Logger.Info("[{0}]IIS Process found. Path:{1}", process.Id, processPath); - if (CleanPath(processPath) == CleanPath(IISExe)) + if (NormalizePath(processPath) == NormalizePath(IISExe)) { Logger.Info("[{0}]Process is considered orphaned.", process.Id); KillProcess(process); @@ -124,7 +136,7 @@ namespace NzbDrone } } - private static void OnDataReceived(object s, DataReceivedEventArgs e) + private static void OnOutputDataReceived(object s, DataReceivedEventArgs e) { if (e == null || String.IsNullOrWhiteSpace(e.Data) || e.Data.StartsWith("Request started:") || e.Data.StartsWith("Request ended:") || e.Data == ("IncrementMessages called")) @@ -167,9 +179,19 @@ namespace NzbDrone } } - private static string CleanPath(string path) + public static string NormalizePath(string path) { - return path.ToLower().Replace("\\", "").Replace("//", "//"); + if (String.IsNullOrWhiteSpace(path)) + throw new ArgumentException("Path can not be null or empty"); + + var info = new FileInfo(path); + + if (info.FullName.StartsWith(@"\\")) //UNC + { + return info.FullName.TrimEnd('/', '\\', ' '); + } + + return info.FullName.Trim('/', '\\', ' ').ToLower(); } diff --git a/NzbDrone/NzbDrone.csproj b/NzbDrone/NzbDrone.csproj index e3b4625cf..1db1eb56e 100644 --- a/NzbDrone/NzbDrone.csproj +++ b/NzbDrone/NzbDrone.csproj @@ -13,6 +13,7 @@ v4.0 512 + false publish\ true Disk @@ -25,7 +26,6 @@ true 0 1.0.0.%2a - false false true diff --git a/NzbDrone/Program.cs b/NzbDrone/Program.cs index 310b0846e..eb891dd20 100644 --- a/NzbDrone/Program.cs +++ b/NzbDrone/Program.cs @@ -21,6 +21,7 @@ namespace NzbDrone 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(); From d64eb579a5edf53f054224788940be7ed2bae0aa Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 24 Apr 2011 20:51:56 -0700 Subject: [PATCH 2/3] Downgraded some logs --- NzbDrone.Web/NzbDrone.Web.Publish.xml | 869 ++++++++++++++++++++------ 1 file changed, 679 insertions(+), 190 deletions(-) diff --git a/NzbDrone.Web/NzbDrone.Web.Publish.xml b/NzbDrone.Web/NzbDrone.Web.Publish.xml index d7db229df..431617f58 100644 --- a/NzbDrone.Web/NzbDrone.Web.Publish.xml +++ b/NzbDrone.Web/NzbDrone.Web.Publish.xml @@ -64,7 +64,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -107,11 +107,9 @@ - - @@ -122,8 +120,10 @@ + + @@ -136,7 +136,7 @@ - + @@ -162,66 +162,63 @@ - - + + - - + - + + + - + + - + + - - + + - + - - + - - + - - + + - - - + - - - + @@ -229,89 +226,97 @@ - + - - - + + + + + + - + + - - - + + - + + - + + + - - - - + + + + - - + + - + + - + + - + + - + - + + + - - - + + - - - + + - + + - - - + @@ -320,33 +325,31 @@ - + + - - + + + - - - + + - - - - - + + + - @@ -354,294 +357,780 @@ - - - - + + + - + - - - + + - - - + + - - + + + - + - - + - - - + - - + - + - - - + + + - - - - - - + + + + - + + + - - + + - + + - - - + - - - + + + - - - + + - - - - - + + - + + - - - + + - + + - - + + - - + + + - + - - - - - + + + - + - - + + - + - - + + + - + + + - + + + - - + + + - - - + + + - + - - + + - - + + + + - + - + + - - + + - + - + - + - - - - - + + + + - + - - + - - - + + + - - + + - - - - - + + + + + + - + + - - + + - + + - + - + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file From 6f4a9f577e28c3de52dd6ab5ffb335ec08a44f46 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 24 Apr 2011 21:15:23 -0700 Subject: [PATCH 3/3] Downgraded more logs --- NzbDrone.Core/Parser.cs | 2 +- NzbDrone.Core/Providers/Indexer/IndexerProviderBase.cs | 6 +++--- NzbDrone.Core/Providers/Jobs/JobProvider.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index 9e6bef3b0..349da5345 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -114,7 +114,7 @@ namespace NzbDrone.Core return parsedEpisode; } } - Logger.Warn("Unable to parse text into episode info. {0}", title); + Logger.Debug("Unable to parse text into episode info. {0}", title); return null; } diff --git a/NzbDrone.Core/Providers/Indexer/IndexerProviderBase.cs b/NzbDrone.Core/Providers/Indexer/IndexerProviderBase.cs index 59835a18d..815776687 100644 --- a/NzbDrone.Core/Providers/Indexer/IndexerProviderBase.cs +++ b/NzbDrone.Core/Providers/Indexer/IndexerProviderBase.cs @@ -61,13 +61,13 @@ namespace NzbDrone.Core.Providers.Indexer /// public void Fetch() { - _logger.Info("Fetching feeds from " + Settings.Name); + _logger.Debug("Fetching feeds from " + Settings.Name); foreach (var url in Urls) { try { - _logger.Debug("Downloading RSS " + url); + _logger.Trace("Downloading RSS " + url); var feed = SyndicationFeed.Load(_httpProvider.DownloadXml(url)).Items; foreach (var item in feed) @@ -130,7 +130,7 @@ namespace NzbDrone.Core.Providers.Indexer { return; } - + var sabTitle = _sabProvider.GetSabTitle(parseResult); if (_sabProvider.IsInQueue(sabTitle)) diff --git a/NzbDrone.Core/Providers/Jobs/JobProvider.cs b/NzbDrone.Core/Providers/Jobs/JobProvider.cs index e07fc21fc..3201571e2 100644 --- a/NzbDrone.Core/Providers/Jobs/JobProvider.cs +++ b/NzbDrone.Core/Providers/Jobs/JobProvider.cs @@ -70,7 +70,7 @@ namespace NzbDrone.Core.Providers.Jobs { if (_isRunning) { - Logger.Warn("Another instance of this job is already running. Ignoring request."); + Logger.Info("Another instance of this job is already running. Ignoring request."); return false; } _isRunning = true; @@ -113,7 +113,7 @@ namespace NzbDrone.Core.Providers.Jobs { if (_isRunning) { - Logger.Warn("Another job is already running. Ignoring request."); + Logger.Info("Another job is already running. Ignoring request."); return false; } _isRunning = true;