From e58576bcfaa7e45ae848c7e79d72d89ecbeea1df Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 19 Feb 2015 09:18:41 -0800 Subject: [PATCH] Don't try to set console logging when its not enabled --- .../Instrumentation/ReconfigureLogging.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs b/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs index 794c45dbd..c7ea9841f 100644 --- a/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs +++ b/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs @@ -28,11 +28,14 @@ public void Reconfigure() var rules = LogManager.Configuration.LoggingRules; //Console - var consoleLoggerRule = rules.Single(s => s.Targets.Any(t => t is ColoredConsoleTarget)); - consoleLoggerRule.EnableLoggingForLevel(LogLevel.Trace); - - SetMinimumLogLevel(consoleLoggerRule, minimumLogLevel); + var consoleLoggerRule = rules.SingleOrDefault(s => s.Targets.Any(t => t is ColoredConsoleTarget)); + if (consoleLoggerRule != null) + { + consoleLoggerRule.EnableLoggingForLevel(LogLevel.Trace); + SetMinimumLogLevel(consoleLoggerRule, minimumLogLevel); + } + //Log Files var rollingFileLoggerRule = rules.Single(s => s.Targets.Any(t => t is NzbDroneFileTarget)); rollingFileLoggerRule.EnableLoggingForLevel(LogLevel.Trace);