Java Throwable to String getStackTrace(final Throwable aThrowable)

Here you can find the source of getStackTrace(final Throwable aThrowable)

Description

get Stack Trace

License

Apache License

Declaration

public static String getStackTrace(final Throwable aThrowable) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    public static String getStackTrace(final Throwable aThrowable) {
        String errorMsg = aThrowable.getMessage();
        final Writer result = new StringWriter();
        final PrintWriter printWriter = new PrintWriter(result);
        aThrowable.printStackTrace(printWriter);
        return errorMsg + "\n" + result.toString();
    }//from   w w  w  . j ava 2s  .c o  m
}

Related

  1. getExceptionString(Throwable throwable)
  2. getExceptionText(Throwable e)
  3. getExceptionTrace(Throwable e)
  4. getStackTrace (final Throwable e)
  5. getStackTrace(@Nonnull final Throwable throwable)
  6. getStackTrace(final Throwable e)
  7. getStackTrace(final Throwable error)
  8. getStackTrace(final Throwable exception)
  9. getStackTrace(final Throwable t)