api logging

This commit is contained in:
2026-08-09 15:56:52 +02:00
parent 470ba8de6b
commit 459efae41c
+11
View File
@@ -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");