将堆栈跟踪转换为字符串? [英] Turn a stack trace into a string?

查看:13
本文介绍了将堆栈跟踪转换为字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将堆栈跟踪打印到 GWT 中的字符串?我认为在 java.io 中使用类的常用方法将不起作用,因为 java.io 包在客户端不可用(并且 Writer、PrintWriter 等在该包中)

Is it possible to print a stack trace to a string in GWT? The usual methods of using the classes in java.io won't work I think, because the java.io package is not available clientside (and Writer, PrintWriter, etc are in that package)

谢谢

推荐答案

我不确定 StackTraceElement 是否被模拟,但如果是,你可以运行类似

I'm not sure if StackTraceElement is emulated, but if it is you can run something like

for (StackTraceElement element : exception.getStackTrace()) {
    string += element + "
";
}

这篇关于将堆栈跟踪转换为字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆