[CLAUDE] Api: dao Serilog request-logging ra vong NGOAI GlobalExceptionMiddleware
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 9m38s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 9m38s
No quan-sat tien-ton (cicd-monitor bat @S197): Serilog nam vong TRONG nen thay exception bay qua va ghi [ERR] responded 500 cho MOI loi nghiep vu 4xx, trong khi client nhan 404/409 tu middleware vong ngoai. Dao thu tu -> Serilog doc status DA MAP tu Response.StatusCode; 500 that van log [ERR] (GEM LogError + status>499). Cac middleware khac giu nguyen vi tri tuong doi. Test 697 pass + 6 skip (baseline). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@ -167,8 +167,11 @@ var app = builder.Build();
|
|||||||
|
|
||||||
// ---------- Pipeline ----------
|
// ---------- Pipeline ----------
|
||||||
app.UseMiddleware<SecurityHeadersMiddleware>();
|
app.UseMiddleware<SecurityHeadersMiddleware>();
|
||||||
app.UseMiddleware<GlobalExceptionMiddleware>();
|
// Serilog request-logging phải nằm vòng NGOÀI GlobalExceptionMiddleware: nếu nằm trong,
|
||||||
|
// nó thấy exception bay xuyên qua và ghi [ERR] responded 500 cho cả lỗi nghiệp vụ
|
||||||
|
// đã map 4xx (404/409) → log prod đầy 500 giả, nhiễu khi truy sự cố.
|
||||||
app.UseSerilogRequestLogging();
|
app.UseSerilogRequestLogging();
|
||||||
|
app.UseMiddleware<GlobalExceptionMiddleware>();
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user