Cannot output information using HTTP Logging in .net core 6.0 logging console

先生 张 1 Reputation point
2021-12-06T09:47:40.077+00:00

After creating a new .net core 6.0 project, add app.UseHttpLogging(); statement in the Program.cs file. After sending an http request, the console did not output relevant information.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,007 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Brando Zhang-MSFT 2,556 Reputation points Microsoft Vendor
    2021-12-07T02:36:26.05+00:00

    According to your description, I suggest you could make sure you have set the log level to information when you are using this asp.net core 6 httplogging middleware.

    More details, you could refer to below steps:

    1. Open the appsettings.development.json or appsettings.json according to your environment.
    2. Modify the Logging LogLevel's Microsoft.AspNetCore to "Microsoft.AspNetCore": "Information"
    3. Restart the application.

    Result:

    155456-image.png

    155494-image.png