Skip to content

Navigation Menu

Sign in
Sign up

FastAPI has no structured access log #180

Open
Labels
enhancementNew feature or request

Description

FastAPI is the only supported framework whose logging instrument binds nothing framework-specific.

fastapi_bootstrapper.py:183 lists the base LoggingInstrument in instruments_types. Every other framework ships a subclass that binds its own logger:

  • LitestarLoggingInstrument (litestar_bootstrapper.py:197)
  • FastStreamLoggingInstrument (faststream_bootstrapper.py:120)
  • FastMcpLoggingInstrument (fastmcp_bootstrapper.py:126)

So a FastAPI service gets structlog configured process-wide and no structured access log, while a Litestar service gets both. That is an empty cell in the instrument x framework matrix, not a missing instrument — it fits the per-instrument axis ADR-0002 keeps, as one more subclass.

Constraint on the implementation

Whatever binds the access log must not log request or response bodies by default. That was a real defect on the Litestar side, fixed in 54c8ad9 (fix(litestar): stop logging request and response bodies by default), with a follow-up in cfb7650. A FastAPI access log that reintroduces body logging would be the same bug in a new cell.

Verification

The invariant worth pinning is that the access log excludes bodies, named as the claim per the AGENTS.md INVARIANT: convention — the shape of the log line itself is behaviour, and belongs in the test, not in prose.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /