# Logging, Error Tracking and Monitoring

> Know when production breaks before users tell you, with structured logs, error tracking, uptime checks and basic metrics. Free notes, key concepts, resources...

Canonical: https://www.internhack.in/roadmaps/tracks/full-stack/logging-and-monitoring
Last updated: 2026-11-28

Know when production breaks before users tell you, with structured logs, error tracking, uptime checks and basic metrics.

Intermediate · about 5 hours · difficulty 3/5

Learn first: [Error Handling, Validation and API Hardening](https://www.internhack.in/roadmaps/tracks/full-stack/api-errors-and-validation), [Environments, Config and Secrets](https://www.internhack.in/roadmaps/tracks/full-stack/environment-and-config)

Once real students use your app, you cannot attach a debugger. **Observability** is how you find out what happened.

### Structured logs

- Log JSON with a level, message, timestamp, request id and user id (never passwords or tokens). **Pino** is a fast, popular choice for Node.js.
- Log at boundaries: incoming request, outgoing response with status and duration, and errors with stack traces.
- Ship logs to a place you can search (your platform's log viewer, Better Stack, Grafana Loki).

### Error tracking

**Sentry** (or a similar tool) captures exceptions from both browser and server with stack traces, the release version and breadcrumbs of what the user did. Upload source maps so minified frontend errors are readable.

### Metrics and uptime

- An **uptime check** on a health endpoint, alerting you by email or Slack.
- Basic metrics: request rate, error rate, latency (p50 and p95), database connection usage.
- **OpenTelemetry** is the standard for traces and metrics when you outgrow the basics.

### Alerting

Alert on symptoms users feel (error rate up, site down, latency high), not on every log line. Too many alerts get ignored.

### Pitfalls

- console.log debugging left in production with no structure.
- Logging personal data such as phone numbers and Aadhaar details.
- Discovering an outage from a WhatsApp message.

You are ready to move on when a deliberate error in production shows up in your error tracker with a readable stack trace and request id, and your uptime monitor alerts you when the app goes down.

## Key concepts

- **Structured JSON logging**
- **Request ids and correlation**
- **Error tracking with Sentry**
- **Source maps**
- **Uptime checks**
- **Latency and error rate metrics**
- **OpenTelemetry tracing**
- **Alerting without noise**

## Mini project

Add Pino structured logging with request ids, Sentry on client and server with source maps, and an uptime monitor with alerts to your deployed portal. Trigger a test error and trace it from alert to log line.

## Check yourself

A student reports 'the apply button did nothing' at 9:42 pm. Which tools and fields would you use to find out what happened?

## Free resources

- [Sentry Documentation](https://docs.sentry.io/) (Sentry)
- [Pino](https://getpino.io/) (Pino)
- [OpenTelemetry Documentation](https://opentelemetry.io/docs/) (OpenTelemetry)

Previous: [CI/CD with GitHub Actions](https://www.internhack.in/roadmaps/tracks/full-stack/ci-cd) · Next: [Web Performance and Core Web Vitals](https://www.internhack.in/roadmaps/tracks/full-stack/web-performance)

## More in CI, Observability and Performance

- [CI/CD with GitHub Actions](https://www.internhack.in/roadmaps/tracks/full-stack/ci-cd)
- [Logging, Error Tracking and Monitoring](https://www.internhack.in/roadmaps/tracks/full-stack/logging-and-monitoring)
- [Web Performance and Core Web Vitals](https://www.internhack.in/roadmaps/tracks/full-stack/web-performance)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Full-Stack Developer Roadmap](https://www.internhack.in/roadmaps/tracks/full-stack)
