diff --git a/services/SharedKernel/FilterLists.SharedKernel.Logging/ConfigurationBuilder.cs b/services/SharedKernel/FilterLists.SharedKernel.Logging/ConfigurationBuilder.cs index 386902945..201781f6e 100644 --- a/services/SharedKernel/FilterLists.SharedKernel.Logging/ConfigurationBuilder.cs +++ b/services/SharedKernel/FilterLists.SharedKernel.Logging/ConfigurationBuilder.cs @@ -1,5 +1,4 @@ -using Microsoft.ApplicationInsights; -using Serilog; +using Serilog; using Serilog.Events; namespace FilterLists.SharedKernel.Logging @@ -12,13 +11,7 @@ internal static class ConfigurationBuilder .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning) .Enrich.FromLogContext() - .WriteTo.Console(); - - public static LoggerConfiguration WriteToApplicationInsights( - this LoggerConfiguration loggerConfiguration, - TelemetryClient telemetryClient) - { - return loggerConfiguration.WriteTo.ApplicationInsights(telemetryClient, TelemetryConverter.Traces); - } + .WriteTo.Console() + .WriteTo.ApplicationInsights(TelemetryConverter.Traces); } } diff --git a/services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs b/services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs index 39f708e58..552cd028a 100644 --- a/services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs +++ b/services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs @@ -1,6 +1,5 @@ using System; using System.Threading.Tasks; -using Microsoft.ApplicationInsights; using Microsoft.Extensions.Hosting; using Serilog; @@ -12,10 +11,7 @@ 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 - .WriteToApplicationInsights(telemetryClient) - .CreateLogger(); + Log.Logger = ConfigurationBuilder.BaseLoggerConfiguration.CreateLogger(); try {