1) logging模块 2)打印当前调用堆栈(非Exception堆栈) import inspect print inspect.stack() 3)打印exception异常堆栈 traceback