Fixed: Don't log handled exceptions in API

Closes #5690
This commit is contained in:
Mark McDowall 2023-05-26 17:13:38 -07:00
parent af55e322f1
commit 59f2e5b65d
1 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Hosting.WindowsServices; using Microsoft.Extensions.Hosting.WindowsServices;
using Microsoft.Extensions.Logging;
using NLog; using NLog;
using NzbDrone.Common.Composition.Extensions; using NzbDrone.Common.Composition.Extensions;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
@ -20,6 +21,7 @@ using NzbDrone.Common.Instrumentation;
using NzbDrone.Common.Instrumentation.Extensions; using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore.Extensions; using NzbDrone.Core.Datastore.Extensions;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
namespace NzbDrone.Host namespace NzbDrone.Host
{ {
@ -119,6 +121,10 @@ namespace NzbDrone.Host
return new HostBuilder() return new HostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseServiceProviderFactory(new DryIocServiceProviderFactory(new Container(rules => rules.WithNzbDroneRules()))) .UseServiceProviderFactory(new DryIocServiceProviderFactory(new Container(rules => rules.WithNzbDroneRules())))
.ConfigureLogging(logging =>
{
logging.AddFilter("Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware", LogLevel.None);
})
.ConfigureContainer<IContainer>(c => .ConfigureContainer<IContainer>(c =>
{ {
c.AutoAddServices(Bootstrap.ASSEMBLIES) c.AutoAddServices(Bootstrap.ASSEMBLIES)