|
|
@ -33,22 +33,25 @@ 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)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Register();
|
|
|
|
if (args.ActivatedConfiguration != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Register();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public LoggingRule Rule { get; set; }
|
|
|
|
public LoggingRule Rule { get; set; }
|
|
|
|