diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index f7a7e717f..7e92ec6ac 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -104,7 +104,7 @@
-
+
diff --git a/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj b/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj
index ca4688cf5..7fe0a2d5a 100644
--- a/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj
+++ b/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/src/Lidarr.Http/Lidarr.Http.csproj b/src/Lidarr.Http/Lidarr.Http.csproj
index 5633a8174..5f2136f70 100644
--- a/src/Lidarr.Http/Lidarr.Http.csproj
+++ b/src/Lidarr.Http/Lidarr.Http.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/src/NzbDrone.Common/Lidarr.Common.csproj b/src/NzbDrone.Common/Lidarr.Common.csproj
index 97c67662d..5b21c3f30 100644
--- a/src/NzbDrone.Common/Lidarr.Common.csproj
+++ b/src/NzbDrone.Common/Lidarr.Common.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs b/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs
index 212f41b58..cfebb3947 100644
--- a/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs
+++ b/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs
@@ -33,22 +33,25 @@ namespace NzbDrone.Core.Instrumentation
LogManager.Configuration.AddTarget("DbLogger", target);
LogManager.Configuration.LoggingRules.Add(Rule);
- LogManager.ConfigurationReloaded += OnLogManagerOnConfigurationReloaded;
+ LogManager.ConfigurationChanged += OnLogManagerOnConfigurationChanged;
LogManager.ReconfigExistingLoggers();
}
public void UnRegister()
{
- LogManager.ConfigurationReloaded -= OnLogManagerOnConfigurationReloaded;
+ LogManager.ConfigurationChanged -= OnLogManagerOnConfigurationChanged;
LogManager.Configuration.RemoveTarget("DbLogger");
LogManager.Configuration.LoggingRules.Remove(Rule);
LogManager.ReconfigExistingLoggers();
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; }
@@ -97,9 +100,14 @@ namespace NzbDrone.Core.Instrumentation
WritePostgresLog(log, connectionString);
}
}
+ catch (NpgsqlException ex)
+ {
+ InternalLogger.Error("Unable to save log event to database: {0}", ex);
+ throw;
+ }
catch (SQLiteException ex)
{
- InternalLogger.Error(ex, "Unable to save log event to database");
+ InternalLogger.Error("Unable to save log event to database: {0}", ex);
throw;
}
}
@@ -128,10 +136,8 @@ namespace NzbDrone.Core.Instrumentation
private void WriteSqliteLog(Log log, string connectionString)
{
using (var connection =
- SQLiteFactory.Instance.CreateConnection())
+ new SQLiteConnection(connectionString).OpenAndReturn())
{
- connection.ConnectionString = connectionString;
- connection.Open();
using (var sqlCommand = connection.CreateCommand())
{
sqlCommand.CommandText = INSERT_COMMAND;
diff --git a/src/NzbDrone.Core/Lidarr.Core.csproj b/src/NzbDrone.Core/Lidarr.Core.csproj
index 311186b4f..2696e1ab8 100644
--- a/src/NzbDrone.Core/Lidarr.Core.csproj
+++ b/src/NzbDrone.Core/Lidarr.Core.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/src/NzbDrone.Mono/Lidarr.Mono.csproj b/src/NzbDrone.Mono/Lidarr.Mono.csproj
index a254e31ed..b9b88b769 100644
--- a/src/NzbDrone.Mono/Lidarr.Mono.csproj
+++ b/src/NzbDrone.Mono/Lidarr.Mono.csproj
@@ -4,7 +4,7 @@
true
-
+
diff --git a/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj b/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj
index 2df882ffb..4d2832ec8 100644
--- a/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj
+++ b/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/NzbDrone.Update/Lidarr.Update.csproj b/src/NzbDrone.Update/Lidarr.Update.csproj
index 685e54612..a141ef9e4 100644
--- a/src/NzbDrone.Update/Lidarr.Update.csproj
+++ b/src/NzbDrone.Update/Lidarr.Update.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/NzbDrone.Windows/Lidarr.Windows.csproj b/src/NzbDrone.Windows/Lidarr.Windows.csproj
index 1da818088..6eeee23d4 100644
--- a/src/NzbDrone.Windows/Lidarr.Windows.csproj
+++ b/src/NzbDrone.Windows/Lidarr.Windows.csproj
@@ -4,7 +4,7 @@
true
-
+