我正试图从Apache Camel:中的onException处理程序中检索堆栈
<onException>
<exception>java.lang.Exception</exception>
<handled>
<constant>true</constant>
</handled>
<setHeader headerName="exception">
<simple>${exception}</simple>
</setHeader>
</onException>
然而,上面只显示了异常,而不是整个堆栈。
我知道Camel将捕获的异常存储为Exchange上的一个属性,密钥为:Exchange.exception_COUGHT,但如何从Camel上下文路由文件中检索到这一点?
使用exception.stacktrace获取堆栈跟踪。请参阅本页表格中列出的变量:http://camel.apache.org/simple
<simple>${exception.stacktrace}</simple>
还有一个${exception.message}引用异常消息本身。