Log ComponentThe log: component logs message exchanges to the underlying logging mechanism. Camel uses commons-logging which allows you to configure logging via
Refer to the commons-logging user guide for a more complete overview of how to use and configure commons-logging. URI formatlog:loggingCategory[?options] Where loggingCategory is the name of the logging category to use. You can append query options to the URI in the following format, ?option=value&option=value&... For example, a log endpoint typically specifies the logging level using the level option, as follows: log:org.apache.camel.example?level=DEBUG The default logger logs every exchange (regular logging). But Camel also ships with the Throughput logger, which is used whenever the groupSize option is specified. Options
FormattingThe log formats the execution of exchanges to log lines.
Regular logger sampleIn the route below we log the incoming orders at DEBUG level before the order is processed: from("activemq:orders").to("log:com.mycompany.order?level=DEBUG").to("bean:processOrder"); Or using Spring XML to define the route: <route> <from uri="activemq:orders"/> <to uri="log:com.mycompany.order?level=DEBUG"/> <to uri="bean:processOrder"/> </route> Regular logger with formatter sampleIn the route below we log the incoming orders at INFO level before the order is processed. from("activemq:orders"). to("log:com.mycompany.order?showAll=true&multiline=true").to("bean:processOrder"); Throughput logger sampleIn the route below we log the throughput of the incoming orders at DEBUG level grouped by 10 messages. from("activemq:orders"). to("log:com.mycompany.order?level=DEBUG?groupSize=10").to("bean:processOrder"); See Also |