Skip to content

Commit

Permalink
[hosting-logs] Don't register ILogger when calling WithLogging (#4535)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch authored Jun 1, 2023
1 parent ccfbcc6 commit 9b5c483
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/OpenTelemetry.Extensions.Hosting/OpenTelemetryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// </copyright>

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OpenTelemetry.Internal;
using OpenTelemetry.Logs;
using OpenTelemetry.Metrics;
Expand Down Expand Up @@ -141,15 +140,9 @@ public OpenTelemetryBuilder WithTracing(Action<TracerProviderBuilder> configure)
/// Adds logging services into the builder.
/// </summary>
/// <remarks>
/// Notes:
/// <list type="bullet">
/// <item>This is safe to be called multiple times and by library authors.
/// Note: This is safe to be called multiple times and by library authors.
/// Only a single <see cref="LoggerProvider"/> will be created for a given
/// <see cref="IServiceCollection"/>.</item>
/// <item>This operation enables <see cref="ILogger"/> integration
/// automatically by calling <see
/// cref="OpenTelemetryLoggingExtensions.AddOpenTelemetry(ILoggingBuilder)"/>.</item>
/// </list>
/// <see cref="IServiceCollection"/>.
/// </remarks>
/// <returns>The supplied <see cref="OpenTelemetryBuilder"/> for chaining
/// calls.</returns>
Expand All @@ -168,9 +161,6 @@ internal OpenTelemetryBuilder WithLogging(Action<LoggerProviderBuilder> configur
{
Guard.ThrowIfNull(configure);

// Note: This enables ILogger integration
this.Services.AddLogging().AddOpenTelemetry();

var builder = new LoggerProviderBuilderBase(this.Services);

configure(builder);
Expand Down

0 comments on commit 9b5c483

Please sign in to comment.