【问题标题】:Apache Camel Component specific loggingApache Camel 组件特定的日志记录
【发布时间】:2018-12-01 02:09:35
【问题描述】:

是否可以仅针对特定组件启用登录 apache camel 路由?

我知道如何使用日志组件,以及如何启用骆驼日志记录(针对所有组件和您的路线等),但是否可以仅针对特定组件启用日志记录?

例如我有以下路线(伪代码):

from(fileendpoint)
.log("consumed file")
.choice()
     .when(condition1)
        .process([convert to json and set in exchange])
        .setHeader(Exchange.CONTENT_ENCODING, "application/xml")
        .to(http4endpoint)
     .otherwise()
        .to(anotherendpoint)
.end();

我知道希望能够做的是只为 http4 组件启用日志,以查看将产生的真正请求是什么。但我不需要路线中其他使用过的组件的详细信息(假设可能有更多)。 有没有办法做到这一点?

【问题讨论】:

    标签: java apache-camel


    【解决方案1】:

    由于camel的HTTP4组件在内部使用Apache HTTP客户端(版本4),你应该可以添加

    <logger name="org.apache.http.wire" level="debug"/>
    

    到您的 Log4J 日志配置,以便仅记录与 HTTP 客户端相关的内容。其他日志框架应该和configure类似。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-01
      • 2017-11-30
      • 2015-11-25
      相关资源
      最近更新 更多