Search⌘ K
AI Features

Enabling HTTP Logging and Support for Logging

Understand how to enable HTTP logging middleware in ASP.NET Core, configure various log levels, and use W3CLogger to capture request and response details. This lesson helps you apply logging for auditing and debugging web services while considering performance and compliance.

Enabling HTTP logging

HTTP logging is an optional middleware component that logs information about HTTP requests and HTTP responses, including the following:

  • Information about the HTTP request

  • Headers

  • Body

  • Information about the HTTP response

This is valuable in web services for auditing and debugging scenarios, but beware because it can negatively impact performance. We might also log personally identifiable information (PII), which can cause compliance issues in some jurisdictions.

Log levels

Log levels can be set to the following:

  • Error: Only Error level logs

  • Warning: Error and Warning level logs

  • Information: Error, Warning, and ...