try{ ... }catch(Exception e) { System.out.println("Exception at line LINENUMBER: "+e); }Or I will put it into my custom logger class that has the same format.
The best way that I have found to do this so far is:
String linenumber = new Exception().getStackTrace()[0].getLineNumber(); System.out.println("The line number is " + linenumber);The problem with StackTrace is that it brings things to a halt.
No comments:
Post a Comment