将堆栈跟踪变成一个字符串? [英] Turn a stack trace into a string?

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

问题描述

是否可以将堆栈跟踪打印到GWT中的字符串?我认为在java.io中使用类的常用方法是行不通的,因为java.io包不可用clientside(和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)

谢谢

Thank you

推荐答案

我不确定StackTraceElement是否被模拟,但如果它是可以运行的东西(StackTraceElement元素:exception.getStackTrace()){
string + =元素+\\\
(< / p>

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

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

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

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