Logs, Errors and Health
Log at the right level and log something useful. An error with no context is a puzzle. Include what was being attempted, which record, and which user where that is appropriate.
And never log secrets. Logging a whole request object at an error is how tokens end up in a log file that more people can read than can read the database.
Error tracking beats reading logs. A service that groups the same exception together, counts occurrences and tells you when something new starts happening. The free tiers are generous and it is perhaps twenty minutes to add.
The alternative is finding out from a user, which is both slower and worse: by then somebody has already had the bad experience, and most people do not report it, they leave.
A health endpoint that means something. Not one returning 200 unconditionally, which only proves the process is running. Check the things the application actually needs: can it reach the database, can it reach whatever it depends on. A health check that cannot fail is decoration.
Mark this lesson complete
Signed in, your progress follows you to every device.