mirror of
https://github.com/skoelle/focusapp.git
synced 2026-09-17 20:10:25 +00:00
api logging
This commit is contained in:
+11
@@ -4,6 +4,8 @@ using Microsoft.Extensions.FileProviders;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
builder.Logging.AddFilter("Microsoft.AspNetCore.HttpLogging", LogLevel.Information);
|
||||||
|
|
||||||
// Connection-String aus ENV-Variablen aufbauen (appsettings.json ist Fallback)
|
// Connection-String aus ENV-Variablen aufbauen (appsettings.json ist Fallback)
|
||||||
static string BuildConnectionString(IConfiguration config)
|
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.AddControllers();
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen();
|
||||||
@@ -77,6 +87,7 @@ if (app.Environment.IsDevelopment())
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.UseCors("AllowReact");
|
app.UseCors("AllowReact");
|
||||||
|
app.UseHttpLogging();
|
||||||
|
|
||||||
// STATIC FILES VOR UseRouting!
|
// STATIC FILES VOR UseRouting!
|
||||||
var clientPath = Path.Combine(app.Environment.ContentRootPath, "client", "build");
|
var clientPath = Path.Combine(app.Environment.ContentRootPath, "client", "build");
|
||||||
|
|||||||
Reference in New Issue
Block a user