Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).

### Changed

- Unhandled exceptions from Flask and Connexion apps are emitted as one JSON record with `level` and `exc_info`
instead of a plain multi-line traceback. `init_*()` now converts handlers already attached to the root logger, and
`init_request_instrument(app)` for Flask and Connexion converts `flask.logging.default_handler`. Applications that
attach a root handler with their own formatter before `init_*()` will see that handler emit JSON as well when JSON
logging is enabled. `config_root_logger()` is still needed for handlers added after initialisation. (#147)
- With JSON logging enabled, unhandled exceptions from Flask and Connexion apps are emitted as a JSON record
with `level` and `exc_info` when their handlers use JSON formatting, instead of the default plain multi-line
traceback. An explicitly plain-text handler can still emit a multi-line traceback. `init_*()` now converts
handlers already attached to the root logger, and `init_request_instrument(app)` for Flask and Connexion converts
`flask.logging.default_handler`. Applications that attach a root handler with their own formatter before `init_*()`
will see that handler emit JSON as well when JSON logging is enabled. `config_root_logger()` is still needed for
handlers added after initialisation. (#147)

### Fixed

Expand Down Expand Up @@ -60,13 +62,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
- Default output is unchanged except where listed above: a `stack_info` field appears only for records logged with
`stack_info=True`, an empty correlation header now yields the next header or a generated ID instead of `-`, and
pre-existing root logger handlers emit JSON after `init_*()` (#147).
- **Upgrade guidance for existing log pipelines (#147):** With JSON enabled, root logger handlers attached before
`init_*()` are reformatted as JSON. To preserve a plain-text root handler, attach it after initialization with an
**explicit plain-text `logging.Formatter`**; a new handler without a formatter still uses the library's JSON default.
Unhandled Flask exceptions emit structured JSON with `level` and `exc_info` when their active handlers use JSON
formatting. An explicitly plain-text handler can still emit a multi-line traceback. Review log parsers and alerts
that depend on either format.
- The Connexion AsyncApp middleware lives in its own module and is only imported when Connexion 3 is installed, so
`import json_logging` is unaffected for everyone else. (#159)
- `read_request_body` needs Starlette 0.28 or newer. Connexion 2's `AioHttpApp` is not supported; Connexion 3's
Flask-based app works as before.
- CI runs the unit tests on Python 3.9 to 3.14 and the Flask, Quart, FastAPI and Sanic smoke tests on Python 3.9 and
3.14. Python 3.8 and earlier, including Python 2, are not tested.

### Known limitations — Connexion 3 `AsyncApp`

- **Background-task failures:** The ASGI request log is currently emitted after the application call returns. If a
background task raises after the response has been sent, the request log may be missing, even if the client
received a successful response. This was reproduced in-process with Connexion 3.3.0, but not on a live Uvicorn
server.
- **Response-time measurement:** `response_time_ms` currently includes background-task execution time, which may
overstate the time taken to send the HTTP response to the client.
- **Uvicorn access logging:** Initializing request instrumentation for `AsyncApp` disables the `uvicorn.access`
logger process-wide. Applications that also depend on Uvicorn access logging should account for this behavior.

## 1.6.0 - 2026-10-21

### Added
Expand Down