Skip to content

Logs for error responses should include the error code/detail #175

@stevenbal

Description

@stevenbal

Thema / Theme

API

Omschrijving / Description

Remark from Jan Brekelmans from DH. At the moment, log events for error responses do not include the error code/detail (we could include invalidParams as context as well, only the status code. It might be good to also include these to give more insight into what went wrong:

Current format:

{
    "code": 400,
    "request": "POST /klantinteracties/api/v1/partijen",
    "event": "api.handle_exception",
    "user_id": null,
    "request_id": "62814fda2ef339beb6917a1d675150b1",
    "timestamp": "2025-08-12T06:39:23.823687Z",
    "logger": "django_structlog.middlewares.request",
    "level": "error"
}

Toegevoegde waarde / Added value

No response

Aanvullende opmerkingen / Additional context

These logs are emitted via django_structlog, we might be able to bind the additional contextvars via the commonground-api-common exception handler

Metadata

Metadata

Projects

Status

Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions