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

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

问题描述

我正在尝试从Apache Camel中的onException处理程序中检索stacktrace:

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.EXCEPTION_CAUGHT将捕获的异常作为属性存储在Exchange上,但是如何从骆驼上下文路由文件中检索到它呢?

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获取堆栈跟踪.请参阅此页表中列出的变量: 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的Stacktrace的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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