Soenneker.Middlewares.TrafficLogging 11.0.539

Prefix Reserved
dotnet add package Soenneker.Middlewares.TrafficLogging --version 11.0.539
                    
NuGet\Install-Package Soenneker.Middlewares.TrafficLogging -Version 11.0.539
                    
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.Middlewares.TrafficLogging" Version="11.0.539" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Middlewares.TrafficLogging" Version="11.0.539" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Middlewares.TrafficLogging" />
                    
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.Middlewares.TrafficLogging --version 11.0.539
                    
#r "nuget: Soenneker.Middlewares.TrafficLogging, 11.0.539"
                    
#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.Middlewares.TrafficLogging@11.0.539
                    
#: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.Middlewares.TrafficLogging&version=11.0.539
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Middlewares.TrafficLogging&version=11.0.539
                    
Install as a Cake Tool

Soenneker.Middlewares.TrafficLogging

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

Adds structured ASP.NET Core request and response logging with sensitive payload capture disabled by default.

Installation

dotnet add package Soenneker.Middlewares.TrafficLogging

Registration

No service registration is required:

using Soenneker.Middlewares.TrafficLogging.Registrars;

app.UseTrafficLogging();
app.MapControllers();

Place it before endpoints and other middleware whose responses should be logged. WebSocket requests are passed through without traffic logging. If Information logging is disabled for Soenneker.Middlewares.TrafficLogging.TrafficLoggingMiddleware, the middleware adds no request or response capture.

Default output

The default log records method, scheme, host, path, response status, and known body length. It does not log query strings, headers, request bodies, or response bodies.

Enable additional fields individually through configuration:

{
  "TrafficLogging": {
    "LogHeaders": true,
    "LogQueryString": false,
    "LogRequestBody": false,
    "LogResponseBody": false
  }
}

Headers whose names indicate authorization, cookies, API keys, secrets, or tokens are always replaced with [REDACTED]. Header values are capped at 512 characters.

Text-like request and response bodies are captured only when their respective setting is enabled, and only the first 32 KiB is logged. Request body capture is skipped for GET, HEAD, DELETE, and TRACE, for declared empty bodies, for declared bodies over 5 MiB, and for non-text content types. Response capture forwards writes immediately and retains only the capped prefix, so it does not buffer the complete response or delay streaming output.

Security considerations

Opt-in data can still contain passwords, access tokens, personal information, and application-specific secret headers that a name-based redactor cannot identify. Query strings and JSON/form bodies are especially high risk. Enable them only in a controlled environment with appropriate log access, retention, and deletion policies.

Captured text is sanitized for control characters to prevent line-oriented log injection. Host names, paths, header values, and payload text remain attacker-controlled data and should not be used to construct log templates or security decisions.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.539 0 10/26/2026
11.0.538 0 10/26/2026
11.0.537 0 10/26/2026
11.0.536 0 10/26/2026
11.0.535 33 10/26/2026
4.0.534 218 10/15/2026
4.0.533 95 10/15/2026
4.0.532 85 10/15/2026
4.0.531 84 10/14/2026
4.0.530 88 10/14/2026
4.0.528 89 10/14/2026
4.0.527 88 10/14/2026
4.0.524 90 10/14/2026
4.0.516 97 10/13/2026
4.0.514 96 10/12/2026
4.0.512 98 10/12/2026
4.0.511 97 10/12/2026
4.0.508 104 10/11/2026
4.0.507 96 10/11/2026
4.0.506 209 9/30/2026
Loading failed

Enable runtime async for compatible .NET 11 projects