애플리케이션에서 Exception이 발생하면, 일반적으로 디버깅을 위해서 Exception의 Call Stack을 저장한다. 이 내용은 Exception의 Call Stack을 String으로 변환하는 코드이다. Save Exception StackTrace to a String 에서 Exception을 String으로 변환하는 쉬운 예를 보여주고 있다.
몇 개의 예가 있긴 한데, 아래의 코드가 간결하고 좋다..
public static String getException(Exception e ) { StringWriter w = new StringWriter(); e.printStackTrace(new PrintWriter(w)); return w.toString(); }