Soenneker.HttpClients.LoggingHandler 4.0.221

Prefix Reserved
dotnet add package Soenneker.HttpClients.LoggingHandler --version 4.0.221
                    
NuGet\Install-Package Soenneker.HttpClients.LoggingHandler -Version 4.0.221
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.HttpClients.LoggingHandler" Version="4.0.221" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.HttpClients.LoggingHandler" Version="4.0.221" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.HttpClients.LoggingHandler" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.HttpClients.LoggingHandler --version 4.0.221
                    
#r "nuget: Soenneker.HttpClients.LoggingHandler, 4.0.221"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.HttpClients.LoggingHandler@4.0.221
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.HttpClients.LoggingHandler&version=4.0.221
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.HttpClients.LoggingHandler&version=4.0.221
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.HttpClients.LoggingHandler

A delegating handler for structured HTTP request, response, timing, header, and optional body logs.

Install

dotnet add package Soenneker.HttpClients.LoggingHandler

Configure with IHttpClientFactory

using Microsoft.Extensions.Logging;
using Soenneker.HttpClients.LoggingHandler;

var options = new HttpClientLoggingOptions
{
    LogLevel = LogLevel.Debug,
    LogRequestHeaders = true,
    LogResponseHeaders = true,
    LogRequestBody = false,
    LogResponseBody = false
};

services.AddHttpClient("catalog", client =>
{
    client.BaseAddress = new Uri("https://api.example.com/");
})
.AddHttpMessageHandler(serviceProvider =>
    new HttpClientLoggingHandler(
        serviceProvider.GetRequiredService<ILogger<HttpClientLoggingHandler>>(),
        options));

The handler logs the method, path, status code, and elapsed time. Header logging is enabled by default. Request and response bodies and query strings are disabled by default because they commonly contain credentials or personal data.

Redaction and body limits

The default redaction list covers Authorization, Proxy-Authorization, Cookie, Set-Cookie, X-Api-Key, and Api-Key. Replace or extend RedactedHeaders before constructing the handler for application-specific secrets.

var options = new HttpClientLoggingOptions
{
    LogResponseBody = true,
    MaxBodyLogLength = 8_192,
    RedactedHeaders =
    [
        "Authorization",
        "Cookie",
        "Set-Cookie",
        "X-Api-Key",
        "X-Tenant-Token"
    ]
};

MaxBodyLogLength defaults to 4,096 characters. A negative value or int.MaxValue removes the limit and can buffer arbitrarily large content; use that only with payload sizes you control.

Body inspection rewinds seekable content so downstream consumers can still read it. Content with no safely bounded, seekable representation is skipped. A body-read failure is logged as a warning and does not fail the HTTP call, but caller-requested cancellation still propagates.

Set LogQueryString = true only when query parameters are known not to contain secrets. URI query values and body fields are not selectively redacted: when enabled, they are logged as supplied.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Soenneker.HttpClients.LoggingHandler:

Package Downloads
Soenneker.GitHub.Client.Http

Provides a configured, cached HttpClient for GitHub's REST API.

Soenneker.Cloudflare.HttpClient

An async thread-safe HttpClient singleton for the Cloudflare API

Soenneker.Instantly.ClientUtil

Provides a lazily created Instantly generated client over a reusable authenticated transport

Soenneker.Telnyx.Client

Provide a cached HttpClient with Telnyx REST API authentication.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.221 33 9/4/2026
4.0.220 94 9/4/2026
4.0.219 171 9/4/2026
4.0.218 11,208 8/31/2026
4.0.217 641 8/31/2026
4.0.216 678 8/31/2026
4.0.215 324 8/31/2026
4.0.214 4,107 8/30/2026
4.0.213 146 8/30/2026
4.0.212 320 8/30/2026
4.0.211 220 8/30/2026
4.0.210 1,704 8/29/2026
4.0.209 20,546 8/26/2026
4.0.208 333 8/25/2026
4.0.207 117 8/25/2026
4.0.206 5,201 8/22/2026
4.0.205 7,473 8/18/2026
4.0.204 10,964 8/13/2026
4.0.203 313 8/13/2026
4.0.202 1,566 8/12/2026
Loading failed

Updated Multiple NuGet packages