Logs and stack traces in production
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
read deployed logs to find where a failure starts.
Planned topics
- Find the time of the problem, then read around it (
docker logs --since 10m,journalctl -u shop --since ...). - In a stack trace, read the exception type and message, then the "Caused by" chain to the root cause; the first lines of your own package show where.
- Use a request or correlation id to follow one request through the logs.
- Search for
ERRORandWARN, then look at the lines just before the first error. - Do not log secrets or personal data.
Draft outline details
Demonstration
ERROR OrderService - Could not place order 4711
org.springframework.dao.DataIntegrityViolationException: ...
Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "currency"
at com.shop.order.OrderService.place(OrderService.java:58)Check your understanding
Which part of a stack trace usually names the root cause?
Show answer
The last "Caused by".
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.