From dbfde5c70e22191159c7ac59ba60d9fee4bd76f4 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 8 Mar 2022 22:15:28 +0000 Subject: [PATCH] Add HttpLogging --- VoidCat/Program.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/VoidCat/Program.cs b/VoidCat/Program.cs index a115908..2577158 100644 --- a/VoidCat/Program.cs +++ b/VoidCat/Program.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Text; using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.HttpLogging; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; using Newtonsoft.Json; @@ -49,6 +50,12 @@ if (useRedis) services.AddSingleton(cx.GetDatabase()); } +services.AddHttpLogging((o) => +{ + o.LoggingFields = HttpLoggingFields.All; + o.RequestBodyLogLimit = 4096; + o.ResponseBodyLogLimit = 4096; +}); services.AddHttpClient(); services.AddSwaggerGen(c => { @@ -164,6 +171,7 @@ foreach (var migration in migrations) app.UseStaticFiles(); #endif +app.UseHttpLogging(); app.UseRouting(); app.UseCors(); app.UseSwagger();