feat: enable request logging for development environment

This commit is contained in:
2025-07-16 21:25:13 +02:00
parent 09bc6637a8
commit b84de07941
2 changed files with 14 additions and 11 deletions

View File

@@ -46,6 +46,7 @@ builder.Services.AddSingleton(builder.Configuration);
builder.Services.AddScoped<GeneralUseHelpers>(); builder.Services.AddScoped<GeneralUseHelpers>();
builder.Services.AddControllers(); builder.Services.AddControllers();
builder.Services.AddHttpLogging(o => { });
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options => builder.Services.AddSwaggerGen(options =>
@@ -85,13 +86,14 @@ using (var scope = app.Services.CreateScope())
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
{ {
app.UseHttpLogging();
app.UseMigrationsEndPoint(); app.UseMigrationsEndPoint();
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(); app.UseSwaggerUI();
} }
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseCors();
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();

View File

@@ -2,7 +2,8 @@
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Information"
}
} }
},
"Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware": "Information"
} }