Java Get Full Exception StackTrace

As a coder, I am always handling exceptions or errors,or in a word throwables. To impove the release build, I need to collect every throwable information. And I need to get the information as string and post it to the Bug Collect Server. Now here is an easy trick to get stacktrace from a Throwable

1 2 3 4 5 6 7

private String getStackTrace(Throwable t) { final Writer result = new StringWriter(); final PrintWriter printWriter = new PrintWriter(result); t.printStackTrace(printWriter); return result.toString(); }

Others

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏猿人谷

c/c++ 宏中"#"和"##"的用法

c/c++ 宏中"#"和"##"的用法 一、一般用法 我们使用#把宏参数变为一个字符串,用##把两个宏参数贴合在一起. 用法: #i nclude<cstdio...

23250
来自专栏一个会写诗的程序员的博客

Koltin Any 类型Koltin Any 类型

The root of the Kotlin class hierarchy. Every Kotlin class has Any as a supercla...

8820
来自专栏小樱的经验随笔

UVA 11292 Dragon of Loowater(简单贪心)

Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, ...

28770
来自专栏算法修养

HOJ 2091 Chess(三维简单DP)

Chess My Tags (Edit) Source : Univ. of Alberta Local Contest 1999.10.16 ...

385100
来自专栏算法修养

FZU Moon Game(几何)

Accept: 710    Submit: 2038 Time Limit: 1000 mSec    Memory Limit : 32768 KB  P...

33550
来自专栏码匠的流水账

聊聊storm client的nimbus.seeds参数

storm-core-1.1.0-sources.jar!/org/apache/storm/Config.java

22220
来自专栏函数式编程语言及工具

Scalaz(40)- Free :versioned up,再回顾

   在上一篇讨论里我在设计示范例子时遇到了一些麻烦。由于Free Monad可能是一种主流的FP编程规范,所以在进入实质编程之前必须把所有东西都搞清楚。前面遇...

239100
来自专栏Hongten

Hibernate EntityManager

Java Persistence API(JPA)是EJB3.0规范之一,定义了对数据库数据进行持久化操作的接口。HIbernate

15940
来自专栏码匠的流水账

聊聊rocketmq的FileAppender

org/apache/rocketmq/logging/inner/LoggingBuilder.java

8810
来自专栏calmound

POJ 1365 Prime Land

                  Prime Land Time Limit: 1000MS Memory Limit: 10000K Tot...

28640

扫码关注云+社区

领取腾讯云代金券