Tracing the execution of scripts?

Larry Bates larry.bates at websafe.com
Fri Oct 27 10:56:24 EDT 2006


I just thought I would put my 2 cents in on this issue.  Others
have suggested that unit tests are an excellent way of debugging
your code and I agree.  I also find that writing code from the
outset using a logging class (there is one in the standard
library) that allows you to create log files of information as
you run your application is a good idea.  Using increasingly
detailed logs (I use a debug mode of 1,2,3,4 for more detail)
that dump where you are and intermediate variable values works
EXTREMELY well for me.  I leave this code in the application
so that I can have customers (or myself) run the application
in debug mode should I have a hard to find problem.  This is
especially true for long running or lights-out batch apps
that have no UI making debugging even more difficult.  I find
that the overhead of testing if I'm in debug mode and logging
results is almost non-existent to the overall execution speed
of my scripts, but then I don't have very many really speed
sensitive scripts so your mileage might vary.

Hope the information helps.

-Larry



More information about the Python-list mailing list