Printing the current running stack in Python

The traceback module has utility functions for printing the currently running stack, not just tracebacks.

import traceback
import logging

# somewhere in your buggy code
logging.log(1, "".join(traceback.format_stack())

About this entry