Skip to content

Documentation is incomplete in terms of how to actually use these extension methods #11373

Open
@mtaylorfsmb

Description

@mtaylorfsmb

Type of issue

Missing information

Description

The AddExtendedHttpClientLogging extension method seems to be used to add a IHttpClientAsyncLogger. It also seems the only way to control the LoggingOptions. However simply calling this extension method results in a runtime error Unable to resolve service for type 'Microsoft.Extensions.Compliance.Redaction.IRedactorProvider' while attempting to activate 'Microsoft.Extensions.Http.Diagnostics.HttpRouteParser'. There appears to be more extension methods that need to be called first.

To test this I did the following.

services.AddHttpCLient<SomeService>(client => { ... })
       .AddLogger<MyLogger>(false)
       .AddExtendedHttpClientLogging(config => { ... });

It is unclear what purpose this extension serves beyond being able to configure logging options, if it worked. My logger implements IHttpClientAsyncLogger and it is properly called just by using AddLogger.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.httpclientloggingservicecollectionextensions.addextendedhttpclientlogging?view=net-9.0-pp

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/Microsoft.Extensions.DependencyInjection/HttpClientLoggingServiceCollectionExtensions.xml

Document Version Independent Id

1952876e-6a96-8953-9511-1d832671cbe2

Platform Id

8d4b44df-46b2-76de-8220-640554158f99

Article author

@dotnet-bot

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions