Web Development · Advanced level

Advanced level · Module 4: Deployment and Operations · Lesson 3 of 4

Logging and Monitoring

Know when your application breaks and why, through structured logs, error tracking and uptime monitoring.

In this lesson you will

  • Write useful structured logs without personal data
  • Set up uptime and error monitoring with alerts

Key concepts

structured loggingerror trackinguptime monitoringalerts

The lesson

Logs explain what happened. Log requests, errors and important events in a structured format (for example JSON with a level, message and request ID), and never log passwords, tokens or unnecessary personal data.

Error tracking collects unexpected errors with stack traces so you can fix them before users report them. Uptime monitoring checks the site from outside every few minutes and alerts you when it is down.

Alerts must reach someone who can act, through email, SMS or a chat channel, and must be rare enough that people do not ignore them.

Step by step

  1. Add structured logging to the API.
  2. Remove any personal data from logs.
  3. Set up uptime monitoring for the site and API.
  4. Trigger a test alert.

Practice activity

Add logging and monitoring to the booking platform.

Expected result: Logs show requests and errors without personal data and an outage triggers an alert.

Check your understanding

  1. What must never be written to logs?

    Show answer

    Passwords, tokens and unnecessary personal data.

  2. What does uptime monitoring do?

    Show answer

    Checks the site regularly from outside and alerts when it is unreachable.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.