• Post Reply Bookmark Topic Watch Topic
  • New Topic

Caller method and line  RSS feed

 
Amer Seifeddine
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Do you know what is the fastest way to find the caller class and method/ Line?

I know two approaches:
- Printing the thread trace
- New throwable then getting info from it..

Is there another way? What is the best from performance point of view?

Thanks
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thread.currentThread().getStackTrace() should be enough.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!