{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreihg3doje5js6yp32lrc2u3aah2rydyrltaptuu7vp5hwekonb6uu4",
"uri": "at://did:plc:5sgu76a53rz3n6unbykmovqy/app.bsky.feed.post/3mlofifosfhn2"
},
"description": "Logging is the practice of emitting timestamped records of events from running software so operators can reconstruct what happened. Modern systems use structured logging, where each record is a JSON object with named fields (level, timestamp, service, request_id, message, plus arbitrary attributes), making logs queryable rather than just human-readable.\n\n\nLog levels\n\n * TRACE / DEBUG: fine-grained, developer-focused, usually off in production\n * INFO: normal operational events worth noting\n * WA",
"path": "/engineering-glossary/structured-logging-application-logs/",
"publishedAt": "2026-05-12T18:16:28.000Z",
"site": "https://sahilkapoor.com",
"tags": [
"Observability",
"Metrics",
"Distributed Tracing",
"OpenTelemetry",
"Structured Logging Explained: Levels, Examples, and Best Practices"
],
"textContent": "**Logging** is the practice of emitting timestamped records of events from running software so operators can reconstruct what happened. Modern systems use **structured logging** , where each record is a JSON object with named fields (level, timestamp, service, request_id, message, plus arbitrary attributes), making logs queryable rather than just human-readable.\n\n## Log levels\n\n * **TRACE / DEBUG:** fine-grained, developer-focused, usually off in production\n * **INFO:** normal operational events worth noting\n * **WARN:** something unexpected but recoverable\n * **ERROR:** a request or job failed\n * **FATAL:** the process cannot continue\n\n\n\n## Conventions that matter\n\n * **Structured fields, not string interpolation.** `log.info({user_id, action})` beats `log.info(\"user 123 did x\")` because it is queryable.\n * **Correlation IDs.** A `request_id` or `trace_id` threaded through every log line links a single request across services.\n * **PII discipline.** Never log credentials, tokens, or sensitive customer fields.\n * **Sampling at volume.** High-traffic services drop a fraction of INFO logs to control cost; ERRORs are always kept.\n\n\n\n## Common tools\n\n * **Libraries:** pino (Node), zap (Go), structlog (Python), Logback (Java), tracing (Rust)\n * **Aggregators:** Loki, Elasticsearch (ELK), OpenSearch, Datadog, Splunk, Sumo Logic, Better Stack\n\n\n\nš\n\n**Related Terms**\nObservability, Metrics, Distributed Tracing, OpenTelemetry\n\nš\n\n**Further Reading**\nStructured Logging Explained: Levels, Examples, and Best Practices",
"title": "Logging",
"updatedAt": "2026-05-13T19:11:20.407Z"
}