With the release of ASP.NET Core 6, a new Http Logging middleware became available. This middleware transmit requests as log messages through the Microsoft.Extensions.Logging framework.
To enable the middleware, add the following code to your Program.cs:
This will add an instance of the Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware class.
If you now run your application, you will notice no difference and nothing is logged. This is because the HTTP Logging messages are handled as informational messages and these are not enabled by default.
To adjust the log level, you can add the following line to the Logging > LogLevel configuration in the appsettings.json file:
You can further configure the logging through the AddHttpLogging method: