Bump NLog to 5.2.0

(cherry picked from commit a471f1b44f51fa245caae4bb853a3ef45e80e541)
pull/3841/head
Bogdan 1 year ago committed by Qstick
parent 19f6433829
commit 418aac0379

@ -104,7 +104,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" /> <PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" /> <PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NunitXml.TestLogger" Version="3.0.117" /> <PackageReference Include="NunitXml.TestLogger" Version="3.0.131" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TestProject)'=='true' and '$(TargetFramework)'=='net6.0'"> <ItemGroup Condition="'$(TestProject)'=='true' and '$(TargetFramework)'=='net6.0'">

@ -12,7 +12,7 @@
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" /> <PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
<PackageReference Include="FluentValidation" Version="9.5.4" /> <PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="Ical.Net" Version="4.2.0" /> <PackageReference Include="Ical.Net" Version="4.2.0" />
<PackageReference Include="NLog" Version="5.0.4" /> <PackageReference Include="NLog" Version="5.2.0" />
<PackageReference Include="System.IO.Abstractions" Version="17.0.24" /> <PackageReference Include="System.IO.Abstractions" Version="17.0.24" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -5,7 +5,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentValidation" Version="9.5.4" /> <PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="ImpromptuInterface" Version="7.0.1" /> <PackageReference Include="ImpromptuInterface" Version="7.0.1" />
<PackageReference Include="NLog" Version="5.0.4" /> <PackageReference Include="NLog" Version="5.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\NzbDrone.Core\Lidarr.Core.csproj" /> <ProjectReference Include="..\NzbDrone.Core\Lidarr.Core.csproj" />

@ -8,7 +8,7 @@
<PackageReference Include="DryIoc.dll" Version="5.3.4" /> <PackageReference Include="DryIoc.dll" Version="5.3.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog" Version="5.0.4" /> <PackageReference Include="NLog" Version="5.2.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.1" />
<PackageReference Include="Sentry" Version="3.25.0" /> <PackageReference Include="Sentry" Version="3.25.0" />
<PackageReference Include="SharpZipLib" Version="1.3.3" /> <PackageReference Include="SharpZipLib" Version="1.3.3" />

@ -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; }
@ -97,9 +100,14 @@ namespace NzbDrone.Core.Instrumentation
WritePostgresLog(log, connectionString); WritePostgresLog(log, connectionString);
} }
} }
catch (NpgsqlException ex)
{
InternalLogger.Error("Unable to save log event to database: {0}", ex);
throw;
}
catch (SQLiteException ex) 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; throw;
} }
} }
@ -128,10 +136,8 @@ namespace NzbDrone.Core.Instrumentation
private void WriteSqliteLog(Log log, string connectionString) private void WriteSqliteLog(Log log, string connectionString)
{ {
using (var connection = using (var connection =
SQLiteFactory.Instance.CreateConnection()) new SQLiteConnection(connectionString).OpenAndReturn())
{ {
connection.ConnectionString = connectionString;
connection.Open();
using (var sqlCommand = connection.CreateCommand()) using (var sqlCommand = connection.CreateCommand())
{ {
sqlCommand.CommandText = INSERT_COMMAND; sqlCommand.CommandText = INSERT_COMMAND;

@ -15,7 +15,7 @@
<PackageReference Include="FluentValidation" Version="9.5.4" /> <PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="MailKit" Version="3.6.0" /> <PackageReference Include="MailKit" Version="3.6.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog" Version="5.0.4" /> <PackageReference Include="NLog" Version="5.2.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.0.4" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.0.4" />
<PackageReference Include="NLog.Targets.Syslog" Version="7.0.0" /> <PackageReference Include="NLog.Targets.Syslog" Version="7.0.0" />
<PackageReference Include="System.IO.Abstractions" Version="17.0.24" /> <PackageReference Include="System.IO.Abstractions" Version="17.0.24" />

@ -4,7 +4,7 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="NLog" Version="5.0.4" /> <PackageReference Include="NLog" Version="5.2.0" />
<PackageReference Include="System.IO.Abstractions" Version="17.0.24" /> <PackageReference Include="System.IO.Abstractions" Version="17.0.24" />
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1.34-servarr20" /> <PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1.34-servarr20" />
</ItemGroup> </ItemGroup>

@ -6,7 +6,7 @@
<PackageReference Include="FluentAssertions" Version="5.10.3" /> <PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="FluentValidation" Version="9.5.4" /> <PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="Moq" Version="4.16.1" /> <PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="NLog" Version="5.0.4" /> <PackageReference Include="NLog" Version="5.2.0" />
<PackageReference Include="NUnit" Version="3.13.3" /> <PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="RestSharp" Version="106.15.0" /> <PackageReference Include="RestSharp" Version="106.15.0" />
<PackageReference Include="RestSharp.Serializers.SystemTextJson" Version="106.15.0" /> <PackageReference Include="RestSharp.Serializers.SystemTextJson" Version="106.15.0" />

@ -6,7 +6,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DryIoc.dll" Version="5.3.4" /> <PackageReference Include="DryIoc.dll" Version="5.3.4" />
<PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="6.1.1" /> <PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="6.1.1" />
<PackageReference Include="NLog" Version="5.0.4" /> <PackageReference Include="NLog" Version="5.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\NzbDrone.Common\Lidarr.Common.csproj" /> <ProjectReference Include="..\NzbDrone.Common\Lidarr.Common.csproj" />

@ -4,7 +4,7 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="NLog" Version="5.0.4" /> <PackageReference Include="NLog" Version="5.2.0" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" /> <PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

Loading…
Cancel
Save