From d87cf6769b9a2f49645504ef87b072f62cd1530e Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Fri, 25 Sep 2020 19:43:55 -0500 Subject: [PATCH] =?UTF-8?q?fix(logging):=20=F0=9F=90=9B=20try=20TelemetryC?= =?UTF-8?q?onfiguration.CreateDefault()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FilterLists.SharedKernel.Logging/HostRunner.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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