diff --git a/Program.cs b/Program.cs index 5b5e952..ccbac10 100644 --- a/Program.cs +++ b/Program.cs @@ -4,6 +4,8 @@ using Microsoft.Extensions.FileProviders; var builder = WebApplication.CreateBuilder(args); +builder.Logging.AddFilter("Microsoft.AspNetCore.HttpLogging", LogLevel.Information); + // Connection-String aus ENV-Variablen aufbauen (appsettings.json ist Fallback) static string BuildConnectionString(IConfiguration config) { @@ -34,6 +36,14 @@ builder.Services.AddCors(options => }); }); +builder.Services.AddHttpLogging(options => +{ + options.LoggingFields = Microsoft.AspNetCore.HttpLogging.HttpLoggingFields.All; + options.RequestHeaders.Add("traceparent"); + options.RequestBodyLogLimit = 4096; + options.ResponseBodyLogLimit = 4096; +}); + builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); @@ -77,6 +87,7 @@ if (app.Environment.IsDevelopment()) } app.UseCors("AllowReact"); +app.UseHttpLogging(); // STATIC FILES VOR UseRouting! var clientPath = Path.Combine(app.Environment.ContentRootPath, "client", "build");