【问题标题】:Tracing messages through logs in WSO2 ESB 4.8.1通过 WSO2 ESB 4.8.1 中的日志跟踪消息
【发布时间】:2017-04-12 13:57:48
【问题描述】:

我需要获得一个唯一的 ID 来通过日志跟踪消息。 我正在使用 WSO2 ESB 4.8.1。 我找到了一篇与 WSO2 ESB 5.0.0 相关的文章。 http://nuwanzone.blogspot.it/2016/12/wso2-esb-tracing-messages-through-logs.html 。 它描述了如何使用 MessageContext 对象为每条消息设置一个唯一 ID,以便我可以从消息流中的任何位置访问它。 是否也可以在 WSO2 ESB 4.8.1 中实现类似的解决方案? (移植)WSO2 ESB 4.8.1 中的解决方案? 你知道不同的解决方案吗?

【问题讨论】:

  • 如果您正在处理 SOAP 消息,那么您可以使用 MessageID 属性。使用中介器中的常规 get-property() XPath 函数可以使用此属性。
  • 是的,你不能使用旧版本。
  • 感谢@PhilippeSevestre 的回答。是的,我处理 SOAP 消息。我会尽快尝试提前谢谢。
  • 感谢@ThusithaThilinaDayaratne 的回答。我尝试使用文章中描述的 MDC 解决方案,使用我的代理服务之一,但没有成功。 Log4j 不会在我的日志中写入唯一 ID。 WSO2 ESB 4.8.1 使用 jdk 1.7 而 jar 添加到 wso2esb-4.8.1\repository\components\lib 已使用 jdk 1.8 编译。可能是这个问题吗?提前致谢。

标签: wso2 wso2esb mdc


【解决方案1】:

您可以在启动时将 MessageID 保存在属性中,并将其添加到您的日志中介。示例:

<property description="SetMessageUUID" expression="fn:substring-after(get-property('MessageID'), 'urn:uuid:')" name="MessageUUID" scope="default" type ="STRING"/>
<log>
    <property name="Step" expression="Request service A"/>
    <property name="ID" expression="get-property('MessageUUID')"/>
</log>
<call>
.....
</call>
<log>
    <property name="Step" expression="Response service A"/>
    <property name="ID" expression="get-property('MessageUUID')"/>
</log>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-11
    相关资源
    最近更新 更多