繁体   English   中英

Apache Camel 组件特定的日志记录

[英]Apache Camel Component specific logging

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

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

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

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 组件启用日志,以查看将产生的真实请求是什么。 但我不需要路线中其他使用过的组件的详细信息(假设可能有更多)。 有没有办法做到这一点?

由于骆驼的 HTTP4 组件在内部使用 Apache HTTP 客户端(版本 4),您应该能够添加

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

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

对于 Spring Boot,只需将此行添加到application.yaml文件

logging.level.org.apache.http.wire: DEBUG

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM