diff --git a/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj b/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj
index 1cd62fe9e..16e1a8fc3 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 9b78d4cb5..99ef46bc2 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/Instrumentation/Extensions/SentryLoggerExtensions.cs b/src/NzbDrone.Common/Instrumentation/Extensions/SentryLoggerExtensions.cs
index 2e17aad44..417ee4a59 100644
--- a/src/NzbDrone.Common/Instrumentation/Extensions/SentryLoggerExtensions.cs
+++ b/src/NzbDrone.Common/Instrumentation/Extensions/SentryLoggerExtensions.cs
@@ -1,6 +1,6 @@
-using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
using NLog;
-using NLog.Fluent;
namespace NzbDrone.Common.Instrumentation.Extensions
{
@@ -8,47 +8,46 @@ public static class SentryLoggerExtensions
{
public static readonly Logger SentryLogger = LogManager.GetLogger("Sentry");
- public static LogBuilder SentryFingerprint(this LogBuilder logBuilder, params string[] fingerprint)
+ public static LogEventBuilder SentryFingerprint(this LogEventBuilder logBuilder, params string[] fingerprint)
{
return logBuilder.Property("Sentry", fingerprint);
}
- public static LogBuilder WriteSentryDebug(this LogBuilder logBuilder, params string[] fingerprint)
+ public static LogEventBuilder WriteSentryDebug(this LogEventBuilder logBuilder, params string[] fingerprint)
{
return LogSentryMessage(logBuilder, LogLevel.Debug, fingerprint);
}
- public static LogBuilder WriteSentryInfo(this LogBuilder logBuilder, params string[] fingerprint)
+ public static LogEventBuilder WriteSentryInfo(this LogEventBuilder logBuilder, params string[] fingerprint)
{
return LogSentryMessage(logBuilder, LogLevel.Info, fingerprint);
}
- public static LogBuilder WriteSentryWarn(this LogBuilder logBuilder, params string[] fingerprint)
+ public static LogEventBuilder WriteSentryWarn(this LogEventBuilder logBuilder, params string[] fingerprint)
{
return LogSentryMessage(logBuilder, LogLevel.Warn, fingerprint);
}
- public static LogBuilder WriteSentryError(this LogBuilder logBuilder, params string[] fingerprint)
+ public static LogEventBuilder WriteSentryError(this LogEventBuilder logBuilder, params string[] fingerprint)
{
return LogSentryMessage(logBuilder, LogLevel.Error, fingerprint);
}
- private static LogBuilder LogSentryMessage(LogBuilder logBuilder, LogLevel level, string[] fingerprint)
+ private static LogEventBuilder LogSentryMessage(LogEventBuilder logBuilder, LogLevel level, string[] fingerprint)
{
- SentryLogger.Log(level)
- .CopyLogEvent(logBuilder.LogEventInfo)
+ SentryLogger.ForLogEvent(level)
+ .CopyLogEvent(logBuilder.LogEvent)
.SentryFingerprint(fingerprint)
- .Write();
+ .Log();
- return logBuilder.Property("Sentry", null);
+ return logBuilder.Property("Sentry", null);
}
- private static LogBuilder CopyLogEvent(this LogBuilder logBuilder, LogEventInfo logEvent)
+ private static LogEventBuilder CopyLogEvent(this LogEventBuilder logBuilder, LogEventInfo logEvent)
{
- return logBuilder.LoggerName(logEvent.LoggerName)
- .TimeStamp(logEvent.TimeStamp)
+ return logBuilder.TimeStamp(logEvent.TimeStamp)
.Message(logEvent.Message, logEvent.Parameters)
- .Properties(logEvent.Properties.ToDictionary(v => v.Key, v => v.Value))
+ .Properties(logEvent.Properties.Select(p => new KeyValuePair(p.Key.ToString(), p.Value)))
.Exception(logEvent.Exception);
}
}
diff --git a/src/NzbDrone.Common/Instrumentation/NzbDroneFileTarget.cs b/src/NzbDrone.Common/Instrumentation/NzbDroneFileTarget.cs
index 62e41b0e0..26c98968b 100644
--- a/src/NzbDrone.Common/Instrumentation/NzbDroneFileTarget.cs
+++ b/src/NzbDrone.Common/Instrumentation/NzbDroneFileTarget.cs
@@ -1,13 +1,15 @@
-using NLog;
+using System.Text;
+using NLog;
using NLog.Targets;
namespace NzbDrone.Common.Instrumentation
{
public class NzbDroneFileTarget : FileTarget
{
- protected override string GetFormattedMessage(LogEventInfo logEvent)
+ protected override void RenderFormattedMessage(LogEventInfo logEvent, StringBuilder target)
{
- return CleanseLogMessage.Cleanse(Layout.Render(logEvent));
+ var result = CleanseLogMessage.Cleanse(Layout.Render(logEvent));
+ target.Append(result);
}
}
}
diff --git a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs
index c6108471f..436b65821 100644
--- a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs
+++ b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs
@@ -34,6 +34,8 @@ public static void Register(IStartupContext startupContext, bool updateApp, bool
var appFolderInfo = new AppFolderInfo(startupContext);
+ RegisterGlobalFilters();
+
if (Debugger.IsAttached)
{
RegisterDebugger();
@@ -101,6 +103,16 @@ private static void RegisterDebugger()
LogManager.Configuration.LoggingRules.Add(loggingRule);
}
+ private static void RegisterGlobalFilters()
+ {
+ LogManager.Setup().LoadConfiguration(c =>
+ {
+ c.ForLogger("Microsoft.Hosting.Lifetime*").WriteToNil(LogLevel.Info);
+ c.ForLogger("System*").WriteToNil(LogLevel.Warn);
+ c.ForLogger("Microsoft*").WriteToNil(LogLevel.Warn);
+ });
+ }
+
private static void RegisterConsole()
{
var level = LogLevel.Trace;
diff --git a/src/NzbDrone.Common/Lidarr.Common.csproj b/src/NzbDrone.Common/Lidarr.Common.csproj
index 1294f5fbe..9b6be37d9 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/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs
index d80af358e..9e0518cb1 100644
--- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs
+++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs
@@ -3,7 +3,6 @@
using System.IO;
using System.Linq;
using NLog;
-using NLog.Fluent;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation.Extensions;
@@ -206,14 +205,14 @@ public bool VerifyImport(TrackedDownload trackedDownload, List imp
}
else
{
- _logger.Debug()
+ _logger.ForDebugEvent()
.Message("No albums were just imported, but all albums were previously imported, possible issue with download history.")
.Property("ArtistId", trackedDownload.RemoteAlbum.Artist.Id)
.Property("DownloadId", trackedDownload.DownloadItem.DownloadId)
.Property("Title", trackedDownload.DownloadItem.Title)
.Property("Path", trackedDownload.DownloadItem.OutputPath.ToString())
.WriteSentryWarn("DownloadHistoryIncomplete")
- .Write();
+ .Log();
}
trackedDownload.State = TrackedDownloadState.Imported;
diff --git a/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs b/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs
index ee7d2f072..38b695ccc 100644
--- a/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs
+++ b/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs
@@ -117,7 +117,6 @@ private void SetSyslogParameters(string syslogServer, int syslogPort, LogLevel m
syslogTarget.MessageSend.Protocol = ProtocolType.Udp;
syslogTarget.MessageSend.Udp.Port = syslogPort;
syslogTarget.MessageSend.Udp.Server = syslogServer;
- syslogTarget.MessageSend.Udp.ReconnectInterval = 500;
syslogTarget.MessageCreation.Rfc = RfcNumber.Rfc5424;
syslogTarget.MessageCreation.Rfc5424.AppName = _configFileProvider.InstanceName;
diff --git a/src/NzbDrone.Core/Lidarr.Core.csproj b/src/NzbDrone.Core/Lidarr.Core.csproj
index 2fcf79c1b..34b027680 100644
--- a/src/NzbDrone.Core/Lidarr.Core.csproj
+++ b/src/NzbDrone.Core/Lidarr.Core.csproj
@@ -14,9 +14,9 @@
-
-
-
+
+
+
diff --git a/src/NzbDrone.Core/MediaFiles/AudioTag.cs b/src/NzbDrone.Core/MediaFiles/AudioTag.cs
index e4fb6d2a1..f5b226dc2 100644
--- a/src/NzbDrone.Core/MediaFiles/AudioTag.cs
+++ b/src/NzbDrone.Core/MediaFiles/AudioTag.cs
@@ -3,7 +3,6 @@
using System.Globalization;
using System.Linq;
using NLog;
-using NLog.Fluent;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation;
using NzbDrone.Common.Instrumentation.Extensions;
@@ -441,11 +440,11 @@ public void Write(string path)
}
catch (Exception ex)
{
- Logger.Warn()
- .Exception(ex)
- .Message($"Tag writing failed for {path}")
- .WriteSentryWarn("Tag writing failed")
- .Write();
+ Logger.ForWarnEvent()
+ .Exception(ex)
+ .Message($"Tag writing failed for {path}")
+ .WriteSentryWarn("Tag writing failed")
+ .Log();
}
finally
{
diff --git a/src/NzbDrone.Core/MediaFiles/AudioTagService.cs b/src/NzbDrone.Core/MediaFiles/AudioTagService.cs
index 043531fcf..6f4692189 100644
--- a/src/NzbDrone.Core/MediaFiles/AudioTagService.cs
+++ b/src/NzbDrone.Core/MediaFiles/AudioTagService.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
-using NLog.Fluent;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Configuration;
@@ -161,11 +160,11 @@ public void RemoveAllTags(string path)
}
catch (Exception ex)
{
- _logger.Warn()
- .Exception(ex)
- .Message($"Tag removal failed for {path}")
- .WriteSentryWarn("Tag removal failed")
- .Write();
+ _logger.ForWarnEvent()
+ .Exception(ex)
+ .Message($"Tag removal failed for {path}")
+ .WriteSentryWarn("Tag removal failed")
+ .Log();
}
finally
{
diff --git a/src/NzbDrone.Core/MediaFiles/MediaInfoFormatter.cs b/src/NzbDrone.Core/MediaFiles/MediaInfoFormatter.cs
index 60bb6b75d..4909cfcc8 100644
--- a/src/NzbDrone.Core/MediaFiles/MediaInfoFormatter.cs
+++ b/src/NzbDrone.Core/MediaFiles/MediaInfoFormatter.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using NLog;
-using NLog.Fluent;
using NzbDrone.Common.Instrumentation;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Parser;
@@ -65,10 +64,10 @@ public static string FormatAudioCodec(MediaInfoModel mediaInfo)
}
else
{
- Logger.Debug()
- .Message("Unknown audio format: '{0}'.", string.Join(", ", mediaInfo.AudioFormat))
- .WriteSentryWarn("UnknownAudioFormat", mediaInfo.AudioFormat)
- .Write();
+ Logger.ForDebugEvent()
+ .Message("Unknown audio format: '{0}'.", string.Join(", ", mediaInfo.AudioFormat))
+ .WriteSentryWarn("UnknownAudioFormat", mediaInfo.AudioFormat)
+ .Log();
return "Unknown";
}
diff --git a/src/NzbDrone.Mono/Lidarr.Mono.csproj b/src/NzbDrone.Mono/Lidarr.Mono.csproj
index 8c59b7ec9..a254e31ed 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 56d7b19f6..506cd84fc 100644
--- a/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj
+++ b/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/NzbDrone.Update/Lidarr.Update.csproj b/src/NzbDrone.Update/Lidarr.Update.csproj
index 4425a843d..ce0c5acfd 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 e6e8d7116..1da818088 100644
--- a/src/NzbDrone.Windows/Lidarr.Windows.csproj
+++ b/src/NzbDrone.Windows/Lidarr.Windows.csproj
@@ -4,7 +4,7 @@
true
-
+