问题描述
我想将异常的堆栈跟踪记录到文件中。有没有办法,我可以以 String
的形式获取堆栈跟踪,或以某种方式使 ex.printStackTrace()
将曲目打印成流或文件?我知道在Java标准版中有,但是我想在Blackberry中。
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时,BlackBerry只提供堆栈跟踪。所以你应该能够使用printStackTrace和朋友,如果你改变了catch类型。
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月起,有一个支持论坛线索 - 。从那以后,没有任何变化。
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.
这篇关于有没有办法在Blackberry中以String的形式获取异常的堆栈跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!