Skip to content
Novus Examples
jsonl2.8 KB

Structured Log — Multi-Line Stack Traces Inside JSON (jsonl)

Java, Python and Go stack traces carried inside JSON string fields with their newlines escaped — the shape a structured logger produces, and the one that defeats multi-line joining rules written for plain text. Includes a Caused by chain and a goroutine dump.

Preview — first 10 linesjsonl
{"ts":"2026-03-17T09:14:33.090Z","level":"info","service":"checkout-api","msg":"handling request","request_id":"req-000001"}
{"ts":"2026-03-17T09:14:33.270Z","level":"error","service":"checkout-api","msg":"unhandled exception while processing request","request_id":"req-000001","error":{"type":"java.lang.IllegalStateException","message":"java.lang.IllegalStateException: cart 9f31a7 has no priced line items","stack":"java.lang.IllegalStateException: cart 9f31a7 has no priced line items\n\tat com.example.shop.checkout.PricingService.total(PricingService.java:142)\n\tat com.example.shop.checkout.OrderService.place(OrderService.java:88)\n\tat com.example.shop.checkout.OrderController.create(OrderController.java:54)\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)\nCaused by: java.util.NoSuchElementException: no price row for sku SKU-88213\n\tat com.example.shop.catalog.PriceRepository.require(PriceRepository.java:67)\n\t... 12 more","frames":8}}
{"ts":"2026-03-17T09:14:33.360Z","level":"warn","service":"checkout-api","msg":"request failed, returning 500","request_id":"req-000001"}
{"ts":"2026-03-17T09:14:33.600Z","level":"info","service":"payments-api","msg":"handling request","request_id":"req-000004"}
{"ts":"2026-03-17T09:14:33.780Z","level":"error","service":"payments-api","msg":"unhandled exception while processing request","request_id":"req-000004","error":{"type":"shop.payments.errors.UpstreamTimeout","message":"Traceback (most recent call last):","stack":"Traceback (most recent call last):\n  File \"/srv/payments/handlers/authorize.py\", line 118, in authorize\n    charge = psp.create_charge(token, amount_minor, currency)\n  File \"/srv/payments/psp/client.py\", line 141, in _post\n    raise UpstreamTimeout(f\"{path} exceeded {timeout}s\")\nshop.payments.errors.UpstreamTimeout: /v1/charges exceeded 2.0s","frames":6}}
{"ts":"2026-03-17T09:14:33.870Z","level":"warn","service":"payments-api","msg":"request failed, returning 500","request_id":"req-000004"}
{"ts":"2026-03-17T09:14:34.110Z","level":"info","service":"inventory-api","msg":"handling request","request_id":"req-000007"}
{"ts":"2026-03-17T09:14:34.290Z","level":"error","service":"inventory-api","msg":"unhandled exception while processing request","request_id":"req-000007","error":{"type":"runtime.panic","message":"panic: reserve: sku SKU-88213 not found","stack":"panic: reserve: sku SKU-88213 not found\n\ngoroutine 41 [running]:\ngithub.com/example/shop/inventory.(*Reserver).Reserve(0xc0000b4000, {0xc0001a2000, 0x3})\n\t/src/inventory/reserve.go:88 +0x1a4\ngithub.com/example/shop/inventory.handleReserve({0x8f2c40, 0xc0000f6000}, 0xc0001b8100)\n\t/src/inventory/http.go:41 +0xc8","frames":7}}
{"ts":"2026-03-17T09:14:34.380Z","level":"warn","service":"inventory-api","msg":"request failed, returning 500","request_id":"req-000007"}

Specifications

Lines
9
Error Records
3
Languages
Java, Python, Go
Stack Newlines Escaped
true
Has Caused By
true
Has Goroutine Dump
true
Longest Stack Lines
8

Testing contract

Expected to pass
Scenario
Parse the records and render each stack trace over multiple lines.
Expected result
Nine records parse as nine JSON documents, and each error.stack field unescapes to a trace of 6 to 8 lines with its Caused by and goroutine sections intact.

What is a .jsonl file?

JSONL (JSON Lines) is a text format where each line is a complete, independent JSON value, allowing records to be streamed and appended without parsing the whole file. It is not itself a JSON array and each line must stand alone. It is common in logging, machine learning datasets, and data pipelines.

How to use this file

Use an example JSONL to test line-by-line streaming parsers, append-and-resume ingestion, and batch pipelines that process one record per line.

How to use this file for testing

“Structured Log — Multi-Line Stack Traces Inside JSON (jsonl)” is a deterministic Novus Examples fixture for Observability, Log parsing, Error handling. Structured and plain-text telemetry with known timestamps, levels, request identifiers, and error states for testing log ingestion, correlation, dashboards, and alert pipelines.

Documented properties for this file: JSONL · 2,894 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Telemetry fixtures use fixed trace IDs, span IDs, and timestamps so ingestion is reproducible run to run. Point your collector, parser, or query layer at the file and assert the documented span tree, metric families, or severity mix; service and host names are invented.

Code examples

import json

with open("app-multiline-stacktraces.jsonl") as f:
    rows = [json.loads(line) for line in f]
print(len(rows), rows[0])

Generated by generation/observability.py. Free for any use, no attribution required — license.