Question : .net core api how to log requests and responses
Answered by : mushy-manatee-xvsgotf9knl8
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ // Important to have it as early as possible app.UseHttpLogging();
}
services.AddHttpLogging(options =>
{ options.LoggingFields = HttpLoggingFields.RequestPropertiesAndHeaders | HttpLoggingFields.RequestBody;
});
Source : https://josef.codes/asp-net-core-6-http-logging-log-requests-responses/ | Last Update : Tue, 30 Aug 22