public static String exceptionStackTraceToString(Exception ex){
  StringWriter errors=new StringWriter();
  ex.printStackTrace(new PrintWriter(errors));
  return errors.toString();
}

public static String exceptionStackTraceToString ( Exception ex ) { StringWriter errors = new StringWriter ( ) ; ex . printStackTrace ( new PrintWriter ( errors ) ) ; return errors . toString ( ) ; }
create a string from stacktrace
