So here's a small tip I learnt recently which I find useful at times. Quite often it is a pain to debug an application. You just want to have a trace from where a particular method was called.
Simply use this
<code>
MyClass() {
myMethod() {
new RuntimeException().printStackTrace();
}
}
</code>
Now whenever myMethod is called; a stack trace will be printed. So you can easily get the hierarchy of the calls made to reach that execution point. Notice that the Exception was not thrown; hence no handling is needed.
No comments:
Post a Comment