Repository navigation
feat: write debug logs as JSON lines - #1593
Merged
Merged
Conversation
JSONFormatter lives in titiler.core.middleware, so titiler.application and titiler.xarray share it. Its own keys are LogRecord attribute names, so an extra field cannot overwrite them. Its timestamp is ISO 8601 UTC. A field that JSON cannot encode is written as a string, and numpy bools and numbers keep their types. Closes #1190
Contributor
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'TiTiler performance Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.
| Benchmark suite | Current: 9f06a10 | Previous: 9eb344f | Ratio |
|---|---|---|---|
WGS1984Quad response_time |
0.03 s |
0.02 s |
1.50 |
This comment was automatically generated by workflow using github-action-benchmark.
vincentsarago
approved these changes
Dec 1, 2026
Merged
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Technical Context
DEBUGon, logs are JSON lines instead of text.Description
This PR adds
JSONFormattertotitiler.core.middlewareand uses it in the debug logging config oftitiler.applicationandtitiler.xarray. It writes each record as one JSON line with all of its extra fields, including the trace IDs thatLoggingInstrumentoradds when telemetry is on.It differs from the proposal in two ways:
titiler.core, becausetitiler.xarrayhas the same debug config and does not depend ontitiler.application.LogRecordattribute names (e.g.,levelnamerather thanlevel), so an extra field cannot overwrite them.Checklist
uv run pre-commit run --all-files)README.mdto reflect any new environment variables, configuration changes, or breaking updates. (Not applicable:README.mddoes not list settings. TheDEBUGdocs entry is updated.)AI tool usage