private static StackTraceElement [ ] getRealStackTrack ( StackTraceElement [ ] stackTrace , String stackTraceOrigin ) { int ignoreDepth = 0 ; int allDepth = stackTrace . length ; String className ; for ( int i = allDepth - 1 ; i >= 0 ; i -- ) { className = stackTrace [ i ] . getClassName ( ) ; if ( className . startsWith ( XLOG_STACK_TRACE_ORIGIN ) || ( stackTraceOrigin != null && className . startsWith ( stackTraceOrigin ) ) ) { ignoreDepth = i + 1 ; break ; } } int realDepth = allDepth - ignoreDepth ; StackTraceElement [ ] realStack = new StackTraceElement [ realDepth ] ; System . arraycopy ( stackTrace , ignoreDepth , realStack , 0 , realDepth ) ; return realStack ; }
Get the real stack trace all elements that come from XLog library would be dropped .