Created
March 13, 2014 19:13
-
-
Save greyaperez/9534885 to your computer and use it in GitHub Desktop.
Get nice output of the current relevant stack in your app. Insert this snippet anywhere in your code (ideally closer to the last class / method being called).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.out.println("##################\n Relevant Stack\n##################"); | |
for(StackTraceElement stackelement : Thread.currentThread().getStackTrace()){ | |
String[] elementClass = stackelement.getClassName().split("\\."); | |
// Set Relevant Packages Here (com by default) | |
if( elementClass.length > 3 && elementClass[0].equals("com") ) { | |
System.out.println( stackelement.getClassName() + " :: " + stackelement.getMethodName() + "()"); | |
} | |
} | |
System.out.println("##################\n [end] Relevant Stack\n##################\n\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment