diff --git a/services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs b/services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs index 2532135e9..1f5eec3a5 100644 --- a/services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs +++ b/services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using Microsoft.ApplicationInsights; +using Microsoft.ApplicationInsights.Extensibility; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; @@ -13,11 +13,12 @@ public static async Task TryRunWithLoggingAsync(this IHost host, Func? run { _ = host ?? throw new ArgumentNullException(nameof(host)); - var telemetryClient = (TelemetryClient)host.Services.GetService(typeof(TelemetryClient)); Log.Logger = ConfigurationBuilder.BaseLoggerConfiguration .WriteTo.Conditional( _ => host.Services.GetService().IsProduction(), - c => c.ApplicationInsights(telemetryClient, TelemetryConverter.Traces)) + c => c.ApplicationInsights( + TelemetryConfiguration.CreateDefault(), + TelemetryConverter.Traces)) .CreateLogger(); try