the hand of NOD
the hand of NOD

Reputation: 1789

Apache Camel Component specific logging

Is it possible to enable logging in an apache camel route only for specific components?

I know how to use the log component, and how to enable camel logging in general (for all components and your route and so on), but is it possible to enable the logging only for a specific component?

For example I have the following route (pseudo code):

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();

What I know want to be able to do is to enable the log only for the http4 component to see what's the real request that will be produced. But I don't need the detailed information from the other used components in the route (assuming there might be a lot more). Is there a way to accomplish that or not?

Upvotes: 2

Views: 1785

Answers (2)

v.ladynev
v.ladynev

Reputation: 19976

For Spring Boot just add this line to application.yaml file

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

Upvotes: 0

Roman Vottner
Roman Vottner

Reputation: 12849

As the HTTP4 component of camel uses the Apache HTTP client (version 4) internally you should be able to add

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

to your Log4J log configuration in order to log only your HTTP client related stuff. Other logging frameworks should be similar to configure.

Upvotes: 4

Related Questions