问题描述
我要异常的堆栈跟踪记录到文件中。有没有一种方法,我可以得到堆栈跟踪在字符串
,或以某种方式让 ex.printStackTrace()
打印跟踪到流或文件?我知道有在Java标准版做到这一点,但我想这在黑莓手机。
I want to log the stack trace of exceptions into a file. Is there a way that I can get the stack trace in form of a String
, or somehow make ex.printStackTrace()
print the trace into a stream or a file? I know that there is a way to do this in Java standard edition, but I want this in Blackberry.
推荐答案
当你发现一个Throwable的黑莓手机只提供堆栈跟踪。所以,你应该能够使用的printStackTrace和朋友,如果你改变捕捉类型。
BlackBerry only provides stack traces when you catch a Throwable. So you should be able to use printStackTrace and friends if you change the catch type.
修改
对不起,我误解你的问题 - 感谢您的评论。没有,有没有办法得到一个String对象的堆栈跟踪。有一个从2010年1月一个支持论坛主题涵盖这一点 - Stack跟踪捕获(急需)。自那时以来,一切都没有改变。
EDITSorry, I misread your question -- thanks for the comment. No, there's no way to get the stack trace in a String object. There is a support forum thread from January 2010 that covers this - Stack Trace Capture (sorely needed). Nothing has changed since then.
如果你需要这个发展,您可以提取设备一个事件日志>,其中包括堆栈跟踪。但是,这并不能帮助理清生产问题。
If you need this for development, you can extract the event log from the device, which includes stack traces. But that doesn't help sort out production issues.
这篇关于有没有办法得到一个异常的堆栈跟踪,在黑莓的字符串形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!