簡體   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