private static String getCallerFromTheCurrentStack ( ) { StackTraceElement [ ] stes = new Throwable ( ) . getStackTrace ( ) ; for ( StackTraceElement ste : stes ) { String stackLine = ste . toString ( ) ; if ( ! stackLine . contains ( LOG . class . getName ( ) ) ) { return stackLine ; } } return stes [ stes . length - 1 ] . toString ( ) ; }
getCallerFromTheCurrentStack containing full class name method name and line number of the java file name .