DMiddleware 5.5.0
dotnet add package DMiddleware --version 5.5.0
NuGet\Install-Package DMiddleware -Version 5.5.0
<PackageReference Include="DMiddleware" Version="5.5.0" />
paket add DMiddleware --version 5.5.0
#r "nuget: DMiddleware, 5.5.0"
// Install DMiddleware as a Cake Addin #addin nuget:?package=DMiddleware&version=5.5.0 // Install DMiddleware as a Cake Tool #tool nuget:?package=DMiddleware&version=5.5.0
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> <body>
<h1>Request Logging Middleware</h1>
<p>The <strong>Request Logging Middleware</strong> is a custom ASP.NET Core middleware designed to log detailed information about incoming HTTP requests and their corresponding responses. It provides functionality to capture various metrics, including CPU and memory usage, response times, and request details, enhancing monitoring and troubleshooting capabilities in your application.</p>
<h2>Key Features</h2> <ul> <li><strong>Request and Response Logging</strong>: Logs the HTTP method, path, timestamp, and response status, along with request and response bodies (configurable).</li> <li><strong>Performance Metrics</strong>: Tracks CPU usage, memory consumption, and request duration for each processed request.</li> <li><strong>Error Handling</strong>: Captures and logs detailed error information if exceptions occur during request processing.</li> <li><strong>Configurable Options</strong>: Easily configurable options to choose what data to log (request body, headers, response, etc.).</li> <li><strong>Database Integration</strong>: Utilizes a database context to persist log entries for further analysis.</li> </ul>
<h2>Usage</h2> <h3>appSettings.json</h3> <p>insert the following configuration into <code>appSettings.json</code> file:</p> <pre><code>{ "HTTPLogConnection": { "DatabaseProvider": "", // SQL or PostgreSQL, the default is SQL "DefaultConnection": "" } }</code></pre>
<p>To use this middleware, configure it in your ASP.NET Core application’s startup/program.cs:</p>
<pre><code>services.ConfigureDMiddlewareServices(options => { options.SaveRequestBody = true; options.SaveRequesterInfo = true; options.SaveRequestHeader = true; options.SaveResponse = true; options.LogTheLoggDashboard = false; });</code></pre>
<p>Then add the middleware to the request pipeline:</p>
<pre><code>app.UseRequestLogging();</code></pre>
<h4>Accessing the Logs Dashboard</h4>
<p> To access the logs dashboard, you can map the dashboard route by adding the following to your Configure method in Startup.cs or Program.cs:</p>
<pre><code>app.MapDLoggerDashboard();</code></pre> <p>Once the dashboard is configured, you can access it via the following URL:</p> <pre><code>yourURL/DLogger/index.html</code></pre>
<p>This middleware helps developers monitor application behavior and diagnose issues effectively, making it an essential tool for robust application logging.</p>
</body> </html>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- JsonConverter.Newtonsoft.Json (>= 0.7.0)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- Microsoft.AspNetCore.Routing (>= 2.2.2)
- Microsoft.AspNetCore.StaticFiles (>= 2.2.0)
- Microsoft.EntityFrameworkCore (>= 5.0.17)
- Microsoft.EntityFrameworkCore.SqlServer (>= 5.0.17)
- Microsoft.Extensions.Configuration (>= 5.0.0)
- Microsoft.Extensions.Configuration.Json (>= 5.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0.0)
- Microsoft.Extensions.FileProviders.Embedded (>= 9.0.0)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 5.0.7)
- Oracle.EntityFrameworkCore (>= 5.21.1)
- Oracle.ManagedDataAccess.Core (>= 3.21.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.