class ExceptionUtils {

  public static String getFullStackTrace(Throwable throwable) {
    StackTraceElement[] stackElements = throwable.getStackTrace();
    StringBuilder sb = new StringBuilder("[");
    if (stackElements != null) {
      for (int i = 0; i < stackElements.length; i++) {
        sb.append("[");
        sb.append("\"" + stackElements[i].getClassName()).append("\",");
        sb.append("\"" + stackElements[i].getFileName()).append("\",");
        sb.append("\"" + stackElements[i].getLineNumber()).append("\",");
        sb.append("\"" + stackElements[i].getMethodName()).append("\"],");
      }
    }
    String str = CharMatcher.anyOf(",").trimTrailingFrom(sb.toString());
    return str + "]";
  }

}