Python Log Stack

I am debugging a huge web application that was not written by me. That's why I need a way to print each stack call somewhere (stdout or file).

This discussion did not help me. I was thinking about pdb, but this requires interaction when I am looking for an automatic solution. I have only one function call at the beginning of my application and you want to see all the other calls to it.

The behavior should be somewhat similar to the Unix tee command. The Python interpreter must execute code, and at the same time, it must register all function calls from different modules.

Any suggestions?

Edited by:

#!/usr/bin/env python
import openerp
if __name__ == "__main__":
    openerp.cli.main()

So, from this point on, I would like to record all the function calls that main () makes.

+4
1

python, , .

moudule cli :

  #print each executed line:
  python -m trace --count -C . -t MypyFile.py
  #print only called functions:
  python -m trace --listfuncs MypyFile.py

-t -l .

: https://docs.python.org/2/library/trace.html

+2

All Articles