How to prettify application logs for debugging
A practical workflow for cleaning log output, extracting stack traces, formatting JSON logs, and sharing useful debugging notes safely.
Maintained by Ali Aygör. Report a correction.
Logs should become evidence, not noise
Raw logs are often noisy. A useful debugging note turns a large log block into the lines that explain what happened: the first exception, the caused-by chain, the request or correlation ID, the service name, the timestamp, and the relevant payload fragment.
Prettifying logs is not about making them pretty for its own sake. It is about making the failure easier to read, discuss, and reproduce without hiding the important context.
What to extract first
Start with the first meaningful error, not the last repeated line. In Java and Spring logs, the top exception and caused-by section usually matter more than the full reflection stack. In JSON logs, format the event object and look for message, level, trace ID, exception, and context fields.
If the log contains a request ID or correlation ID, keep it visible. That value lets backend, frontend, QA, and operations teams connect the same failure across services.
Safe log sharing
Before posting logs to a ticket or chat, mask tokens, authorization headers, cookies, emails, phone numbers, account IDs, and internal URLs. Leave enough shape for debugging, but remove values that are not needed to understand the bug.
A good log note includes environment, time range, endpoint or job name, sanitized error block, what you expected, and what actually happened. That format helps teammates act without asking for the same context again.
Extract the JSON value rather than parsing the entire log line
A timestamp and severity prefix are not JSON syntax. Retain that metadata in the incident note, then extract the complete structured value for formatting. A truncated value cannot be recovered by indentation.
2026-05-17T12:00:00Z INFO body={"requestId":"demo-42","ok":false}
JSON value to format:
{"requestId":"demo-42","ok":false}Specifications and references
Continue the investigation
How to Debug API Logs Using Correlation IDs
Use request IDs, trace IDs, and correlation IDs to connect API failures across logs, HAR files, stacktraces, and service boundaries.
SQL Query Debugging Checklist
A checklist for formatting SQL, finding dangerous updates, checking joins, reviewing filters, and preparing safer database debugging sessions.
Common JSON syntax errors and how to fix them
A practical guide to the JSON mistakes developers see most often: trailing commas, single quotes, comments, unescaped characters, and broken nesting.
Related tools
Dev Debug Helpers
OpenLog Prettifier
Format JSON logs and semi-structured log lines into cleaner readable output for debugging.
Dev Debug Helpers
OpenAPI Log Analyzer
Analyze API logs for ERROR/WARN/INFO counts, duplicate exceptions, correlation IDs, and timeline buckets.
Dev Debug Helpers
OpenTrace / Correlation ID Extractor
Scan pasted text or logs and extract likely trace, request, and correlation identifiers.
Formatters
OpenJSON Formatter
Pretty-print raw JSON, minify payloads, and inspect syntax errors with clear feedback.
Related workflows
Formatter Tools
Clean up dense developer text so payloads, queries, markup, and logs are easier to inspect.
Regex Tools
Test patterns against realistic text and inspect matches before moving regex into application code.
Timestamp and Date Tools
Convert Unix timestamps and inspect time values found in APIs, logs, JWTs, and databases.
Log Tools
Clean noisy logs, extract trace and correlation IDs, and connect log output to payload debugging tools.