Module 45: Files and Logging

Lesson 5 of 5 · 15–25 minutes

Error reports and monitoring

🏠The everyday picture

A smoke alarm that not only beeps but phones you, says which room, and when it started. You find out even when you're away.

📘What it really is

🖱️Try it

Create a free Sentry account (or use another error service), add its Node.js package, and report unexpected errors from your error handler. Trigger a deliberate error and find it in the dashboard. Add graceful shutdown on SIGTERM that closes the server and logs "Shutting down".

✅Quick check

Why use an error-reporting service if you already log errors?

Show the answer

It groups errors, shows how often they happen and who's affected, and alerts you, so problems aren't missed.

What should a server do when it receives SIGTERM during a deploy?

Show the answer

Stop taking new requests, finish current ones, close connections, and exit cleanly.

← PreviousStructured logging
ProLearners Assist