|
|
@ -33,23 +33,26 @@ namespace NzbDrone.Core.Instrumentation
|
|
|
|
|
|
|
|
|
|
|
|
LogManager.Configuration.AddTarget("DbLogger", target);
|
|
|
|
LogManager.Configuration.AddTarget("DbLogger", target);
|
|
|
|
LogManager.Configuration.LoggingRules.Add(Rule);
|
|
|
|
LogManager.Configuration.LoggingRules.Add(Rule);
|
|
|
|
LogManager.ConfigurationReloaded += OnLogManagerOnConfigurationReloaded;
|
|
|
|
LogManager.ConfigurationChanged += OnLogManagerOnConfigurationChanged;
|
|
|
|
LogManager.ReconfigExistingLoggers();
|
|
|
|
LogManager.ReconfigExistingLoggers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void UnRegister()
|
|
|
|
public void UnRegister()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogManager.ConfigurationReloaded -= OnLogManagerOnConfigurationReloaded;
|
|
|
|
LogManager.ConfigurationChanged -= OnLogManagerOnConfigurationChanged;
|
|
|
|
LogManager.Configuration.RemoveTarget("DbLogger");
|
|
|
|
LogManager.Configuration.RemoveTarget("DbLogger");
|
|
|
|
LogManager.Configuration.LoggingRules.Remove(Rule);
|
|
|
|
LogManager.Configuration.LoggingRules.Remove(Rule);
|
|
|
|
LogManager.ReconfigExistingLoggers();
|
|
|
|
LogManager.ReconfigExistingLoggers();
|
|
|
|
Dispose();
|
|
|
|
Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnLogManagerOnConfigurationReloaded(object sender, LoggingConfigurationReloadedEventArgs args)
|
|
|
|
private void OnLogManagerOnConfigurationChanged(object sender, LoggingConfigurationChangedEventArgs args)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (args.ActivatedConfiguration != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Register();
|
|
|
|
Register();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public LoggingRule Rule { get; set; }
|
|
|
|
public LoggingRule Rule { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|