Skip to content
Ameen Abozaid
In reviewJNR-006-L06

Structured logging

  • Lesson 6 of 7
  • 10 min read
  • Junior
On This Lesson 4 topics

The content for this lesson is written and waiting for review. The outline below shows what it covers. It will be published once it is approved.

In this lesson

explain why logs can be JSON.

Planned topics

  • Text logs are for people; JSON logs are for machines too.
  • A JSON line has named fields: time, level, message, orderId.
  • Log tools can search and count by field.
  • Context values (like a request ID) can be attached to every line (MDC).
  • Switch format by configuration, not by code.
Draft outline details

Demonstration

json
{"time":"2025-01-10T10:15:02Z","level":"INFO","logger":"OrderService","message":"Order placed","orderId":42}

Check your understanding

Why JSON logs?

Show answer

Machines can search and filter by field.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.