【问题标题】:How to log the values of an array in camel body within the route如何在路线内记录骆驼体内数组的值
【发布时间】:2018-11-15 08:00:22
【问题描述】:

我已经粘贴了下面的代码部分,我试图在骆驼体中记录数组

...
    .convertBodyTo(UserInfo[].class)
    .log(LoggingLevel.DEBUG,logger,"Output- ${body}")

但是在日志中

- Output-  (UerInfo[])- [Lcom.bhge.entitlement.service.dto.UserInfo;@1e37cb10

【问题讨论】:

    标签: apache-camel spring-camel


    【解决方案1】:

    使用骆驼豆

    在您的 java 代码中的某处创建一个方法来控制显示并使用camel bean 链接到该方法。


    代码中的日志部分调用UerInfo[].toString(),它返回identity hash code。基于此SO solution,您无法通过现有代码覆盖UerInfo[].toString() 以实现您的目标。

    【讨论】:

      猜你喜欢
      • 2011-05-24
      • 2015-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-22
      • 2015-04-06
      • 1970-01-01
      • 2018-09-05
      相关资源
      最近更新 更多