updated logging/loggly
This commit is contained in:
parent
2f204e3d29
commit
7417f76086
|
@ -31,6 +31,8 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
|
|
||||||
RegisterAppFile(appFolderInfo);
|
RegisterAppFile(appFolderInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogManager.ReconfigExistingLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RegisterConsole()
|
private static void RegisterConsole()
|
||||||
|
@ -51,9 +53,6 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
|
|
||||||
LogManager.Configuration.AddTarget("console", coloredConsoleTarget);
|
LogManager.Configuration.AddTarget("console", coloredConsoleTarget);
|
||||||
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
||||||
|
|
||||||
LogManager.ConfigurationReloaded += (sender, args) => RegisterConsole();
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,9 +79,6 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
|
|
||||||
LogManager.Configuration.AddTarget("appfile", fileTarget);
|
LogManager.Configuration.AddTarget("appfile", fileTarget);
|
||||||
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
||||||
|
|
||||||
LogManager.ConfigurationReloaded += (sender, args) => RegisterAppFile(appFolderInfo);
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,9 +100,6 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
|
|
||||||
LogManager.Configuration.AddTarget("updateFile", fileTarget);
|
LogManager.Configuration.AddTarget("updateFile", fileTarget);
|
||||||
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
||||||
|
|
||||||
LogManager.ConfigurationReloaded += (sender, args) => RegisterUpdateFile(appFolderInfo);
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RegisterExceptron()
|
private static void RegisterExceptron()
|
||||||
|
@ -117,12 +110,10 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
|
|
||||||
LogManager.Configuration.AddTarget("ExceptronTarget", exceptronTarget);
|
LogManager.Configuration.AddTarget("ExceptronTarget", exceptronTarget);
|
||||||
LogManager.Configuration.LoggingRules.Add(rule);
|
LogManager.Configuration.LoggingRules.Add(rule);
|
||||||
LogManager.ConfigurationReloaded += (sender, args) => RegisterExceptron();
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void RegisterLoggly()
|
private static void RegisterLoggly()
|
||||||
{
|
{
|
||||||
var logglyTarger = new LogglyTarget();
|
var logglyTarger = new LogglyTarget();
|
||||||
|
|
||||||
|
@ -130,8 +121,6 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
|
|
||||||
LogManager.Configuration.AddTarget("LogglyLogger", logglyTarger);
|
LogManager.Configuration.AddTarget("LogglyLogger", logglyTarger);
|
||||||
LogManager.Configuration.LoggingRules.Add(rule);
|
LogManager.Configuration.LoggingRules.Add(rule);
|
||||||
LogManager.ConfigurationReloaded += (sender, args) => RegisterLoggly();
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Loggly, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Loggly, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\loggly-csharp.2.2\lib\Loggly.dll</HintPath>
|
<HintPath>..\packages\loggly-csharp.2.3\lib\net35\Loggly.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="loggly-csharp" version="2.2" targetFramework="net40" />
|
<package id="loggly-csharp" version="2.3" targetFramework="net40" />
|
||||||
<package id="Newtonsoft.Json" version="5.0.6" targetFramework="net40" />
|
<package id="Newtonsoft.Json" version="5.0.6" targetFramework="net40" />
|
||||||
<package id="NLog" version="2.0.1.2" targetFramework="net40" />
|
<package id="NLog" version="2.0.1.2" targetFramework="net40" />
|
||||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
|
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
|
||||||
|
|
|
@ -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.Messaging;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Configuration.Events;
|
using NzbDrone.Core.Configuration.Events;
|
||||||
|
@ -28,10 +29,12 @@ 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;
|
||||||
var rollingFileLogger = rules.Single(s => s.Targets.Any(t => t.Name == "rollingFileLogger"));
|
var rollingFileLogger = rules.Single(s => s.Targets.Any(t => t is FileTarget));
|
||||||
rollingFileLogger.EnableLoggingForLevel(LogLevel.Trace);
|
rollingFileLogger.EnableLoggingForLevel(LogLevel.Trace);
|
||||||
|
|
||||||
SetMinimumLogLevel(rollingFileLogger, minimumLogLevel);
|
SetMinimumLogLevel(rollingFileLogger, minimumLogLevel);
|
||||||
|
|
||||||
|
LogManager.ReconfigExistingLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetMinimumLogLevel(LoggingRule rule, LogLevel minimumLogLevel)
|
private void SetMinimumLogLevel(LoggingRule rule, LogLevel minimumLogLevel)
|
||||||
|
|
Loading…
Reference in New Issue