New: Logging level in settings will be used for Console logging
This commit is contained in:
parent
539de9e124
commit
d1df5ed7cd
|
@ -88,11 +88,6 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
{
|
{
|
||||||
var level = LogLevel.Trace;
|
var level = LogLevel.Trace;
|
||||||
|
|
||||||
if (RuntimeInfoBase.IsProduction)
|
|
||||||
{
|
|
||||||
level = LogLevel.Info;
|
|
||||||
}
|
|
||||||
|
|
||||||
var coloredConsoleTarget = new ColoredConsoleTarget();
|
var coloredConsoleTarget = new ColoredConsoleTarget();
|
||||||
|
|
||||||
coloredConsoleTarget.Name = "consoleLogger";
|
coloredConsoleTarget.Name = "consoleLogger";
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
|
using NLog.Targets;
|
||||||
using NzbDrone.Common.Instrumentation;
|
using NzbDrone.Common.Instrumentation;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Configuration.Events;
|
using NzbDrone.Core.Configuration.Events;
|
||||||
|
@ -25,6 +26,14 @@ namespace NzbDrone.Core.Instrumentation
|
||||||
var minimumLogLevel = LogLevel.FromString(_configFileProvider.LogLevel);
|
var minimumLogLevel = LogLevel.FromString(_configFileProvider.LogLevel);
|
||||||
|
|
||||||
var rules = LogManager.Configuration.LoggingRules;
|
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);
|
||||||
|
|
||||||
|
//Log Files
|
||||||
var rollingFileLoggerRule = rules.Single(s => s.Targets.Any(t => t is NzbDroneFileTarget));
|
var rollingFileLoggerRule = rules.Single(s => s.Targets.Any(t => t is NzbDroneFileTarget));
|
||||||
rollingFileLoggerRule.EnableLoggingForLevel(LogLevel.Trace);
|
rollingFileLoggerRule.EnableLoggingForLevel(LogLevel.Trace);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue