Soenneker.Middlewares.TrafficLogging 4.0.506

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

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
4.0.506 91 9/30/2026
4.0.505 83 9/29/2026
4.0.504 87 9/25/2026
4.0.503 91 9/25/2026
4.0.502 90 9/24/2026
4.0.500 87 9/24/2026
4.0.499 90 9/24/2026
4.0.498 168 9/16/2026
4.0.497 88 9/16/2026
4.0.496 96 9/16/2026
4.0.495 93 9/16/2026
4.0.494 97 9/16/2026
4.0.493 101 9/15/2026
4.0.492 100 9/13/2026
4.0.490 101 9/13/2026
4.0.489 101 9/13/2026
4.0.488 102 9/12/2026
4.0.487 96 9/12/2026
4.0.486 91 9/12/2026
4.0.485 88 9/12/2026
Loading failed

Updated Soenneker.Extensions.String to 4.0.770