Skip to content

Instantly share code, notes, and snippets.

@sifue
Created February 14, 2012 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sifue/1826753 to your computer and use it in GitHub Desktop.
Save sifue/1826753 to your computer and use it in GitHub Desktop.
Javaの例外のスタックトレースをStringに変換するスニペット ref: http://qiita.com/items/2486
// エラーのスタックトレースを表示
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
String str = sw.toString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment