Advanced Debugging
Prerequisites: Debugging
For problems that only appear in production (and can't be easily
reproduced locally), two techniques go beyond pdb:
- Structured logging — logging with consistent, searchable fields
(
logging.info("payment failed", extra={"user_id": 42})) instead of free-form text, so a real incident can be traced through millions of log lines. - Application performance monitoring (APM) tools capture a timeline of exactly what a slow or failed request did, across every function and database call it touched.
The underlying discipline is the same as Level 1's debugging lesson — reproduce, narrow down, fix — just with better tools for problems too large or too rare to step through by hand.