Hello @kartik,
Try this:
Thread.currentThread().getStackTrace();
is fine if you don't care what the first element of the stack is.
new Throwable().getStackTrace();
will have a defined position for your current method, if that matters.
Hope it works!!
Thank You!!