public static String traceExcetion(Throwable ex){
  final Writer result=new StringWriter();
  final PrintWriter printWriter=new PrintWriter(result);
  ex.printStackTrace(printWriter);
  String stacktrace=result.toString();
  Log.e(TAG,"ERROR ---> " + stacktrace);
  return stacktrace;
}

public static String traceExcetion ( Throwable ex ) { final Writer result = new StringWriter ( ) ; final PrintWriter printWriter = new PrintWriter ( result ) ; ex . printStackTrace ( printWriter ) ; String stacktrace = result . toString ( ) ; Log . e ( TAG , "ERROR ---> " + stacktrace ) ; return stacktrace ; }
write exception throw in log
