Advertisement
dwhitzzz

LogException

Sep 20th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1.  private void logError(String msg, Throwable e) {
  2.         String exception = "";
  3.         if (e != null) {
  4.             StringWriter sw = new StringWriter();
  5.             PrintWriter pw = new PrintWriter(sw);
  6.             e.printStackTrace(pw);
  7.             exception = e.getMessage() + " " + sw.toString();
  8.         }
  9.        System.out.println(msg + exception);
  10.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement