From 59f2e5b65dd7352aad92b33adefa6cf5ca79a0de Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 26 May 2023 17:13:38 -0700 Subject: [PATCH] Fixed: Don't log handled exceptions in API Closes #5690 --- src/NzbDrone.Host/Bootstrap.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs index d9d62d3c1..110052cf7 100644 --- a/src/NzbDrone.Host/Bootstrap.cs +++ b/src/NzbDrone.Host/Bootstrap.cs @@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting.WindowsServices; +using Microsoft.Extensions.Logging; using NLog; using NzbDrone.Common.Composition.Extensions; using NzbDrone.Common.EnvironmentInfo; @@ -20,6 +21,7 @@ using NzbDrone.Common.Instrumentation; using NzbDrone.Common.Instrumentation.Extensions; using NzbDrone.Core.Configuration; using NzbDrone.Core.Datastore.Extensions; +using LogLevel = Microsoft.Extensions.Logging.LogLevel; namespace NzbDrone.Host { @@ -119,6 +121,10 @@ namespace NzbDrone.Host return new HostBuilder() .UseContentRoot(Directory.GetCurrentDirectory()) .UseServiceProviderFactory(new DryIocServiceProviderFactory(new Container(rules => rules.WithNzbDroneRules()))) + .ConfigureLogging(logging => + { + logging.AddFilter("Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware", LogLevel.None); + }) .ConfigureContainer(c => { c.AutoAddServices(Bootstrap.ASSEMBLIES)