Emit the stack trace automatically in an except block.
Section: Logging and Diagnostics
Log an exception with traceback
python
python
import logging
logger = logging.getLogger(__name__)
try:
risky_call()
except Exception:
logger.exception("Request processing failed")Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Logging and Diagnostics
Attach request or job context to logs
Add contextual identifiers that make debugging easier.
Time a block of code
Measure elapsed time around suspicious code paths.
Benchmark small snippets with timeit
Measure a small expression from the command line.
Print the current exception traceback
Dump the active exception traceback in an except block.