Stacktrace from Camel Context onException

女生的网名这么多〃 提交于 2019-12-18 14:05:06

问题


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.

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 ?


回答1:


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>

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



来源:https://stackoverflow.com/questions/8971894/stacktrace-from-camel-context-onexception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!