Hi all,
I don't know about you, but personally I use the script tracing functionality quite often. Often I just leave it on when I have created something, and then tell the customer to notice the exact time if something fails. Then I can go back, find the trace, and see what happened.
However, one problem with tracing is that if you do something inside a tight loop, such as quering the database, you will get a lot of trace frames which pollute the result (and sometimes it will get cropped because the trace is too large). And viewing the trace gets cumbersome with all those not-so-interesting frames.
So, I just create a new small function: pauseTracing(Bool), which you can put in your script around stuff you don't want to trace. It has an internal counter, and only traces when it is zero. So multiple calls to pauseTracing(true) must be matched with an equal number of calls to pauseTracing(false). Just place those around stuff you don't want to trace like this:
Void doStuff() {
SearchEngine se;
se.addFields("ticket", "id,title");
se.setLimit(10);
pauseTracing(true);
for (se.execute(); !se.eof(); se.next()) {
titles.append(se.getField("ticket.title") + ",");
}
pauseTracing(false);
}
If a script is not being traced, then this call will have no effect. So you can just leave it in your production code. Available from our next release, 10.2.6.
Sverre
Alle Svar (2)
Fantastic, experiences this within 10 minutes of seeing this post.
And since we do alot of quite big restcalls, we see this alot.