来自骆驼上下文的堆栈跟踪 onException [英] Stacktrace from Camel Context onException

查看:24
本文介绍了来自骆驼上下文的堆栈跟踪 onException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Apache Camel 中的 onException 处理程序中检索堆栈跟踪:

I'm trying to retrieve the stacktrace from the onException handler in Apache Camel:

   <onException>
            <exception>java.lang.Exception</exception>
            <handled>
                <constant>true</constant>
            </handled>

            <setHeader headerName="exception">
                <simple>${exception}</simple>
            </setHeader>
   </onException>

但是,上面只显示了异常而不是整个堆栈跟踪.

However, the above only shows the exception rather than the entire stacktrace.

我了解 Camel 将捕获的异常作为属性存储在 Exchange 上,密钥为:Exchange.EXCEPTION_CAUGHT,但是如何从骆驼上下文路由文件中检索到呢?

I understand that Camel stores the caught exception as a property on the Exchange with the key: Exchange.EXCEPTION_CAUGHT, but how can this be retrieved from the camel context routes file ?

推荐答案

使用exception.stacktrace获取stacktrace.请参阅本页表格中列出的变量:http://camel.apache.org/simple

Use exception.stacktrace to get the stacktrace. See the variables listed in the table at this page: http://camel.apache.org/simple

<simple>${exception.stacktrace}</simple>

还有一个 ${exception.message} 来引用异常消息本身.

There is also a ${exception.message} to refer to the exception message itself.

这篇关于来自骆驼上下文的堆栈跟踪 onException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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