问题
I would like to log all the debug information on each step (to crunch all these data later) of a debugging session, such as the name of the method called, the parameter value, all the variables values, etc.
Is there any option that enables this? Where should I change the code to make this happen?
One important thing: it isn't a java program. It's a TCL being run from inside eclipse, using activeState debugger. So AOP and JDT are not options here :-(
TIA
Leo
回答1:
I suggest to use the trace command in tcl.
A simple example:
set ::TraceFd [open {/path/to/logfile} a]
proc ::TraceLog args {
puts $::TraceFd $args
}
trace add execution source {enterstep leavestep} ::TraceLog
source /the/main/file.tcl
This does more or less what you want. I don't have any idea how eclipse works with Tcl, but the best way to debug Tcl is with Tcl :)
回答2:
Depending on your exact needs, maybe have a look at the logger package and its trace Loglevel too, it also uses execution traces to gather some info.
http://tcllib.sourceforge.net/doc/logger.html
You can add them to your code, and if they are switched off you pay zero performance penalty and you can switch them on when needed.
来源:https://stackoverflow.com/questions/15529529/log-all-trace-info-during-a-debug-session-in-eclipse