Add HttpLogging

This commit is contained in:
Kieran 2022-03-08 22:15:28 +00:00
parent 29cd0c20d8
commit dbfde5c70e
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -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();