I have logging function as follows.
logging.basicConfig( filename = fileName, format = \"%(levelname) -10s %(asctime)s %(message)s\", level = logging
import inspect import traceback def method(): frame = inspect.currentframe() stack_trace = traceback.format_stack(frame) print ''.join(stack_trace)
Use stack_trace[:-1] to avoid including method/printinfo in the stack trace.