Using log DSL from Spring - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

In Spring DSL it is also easy to use log DSL as shown below:

<route id="foo">
   <from uri="direct:foo"/>
   <log message="Got ${body}"/>
   <to uri="mock:foo"/>
</route>

The log tag has attributes to set the message, loggingLevel and logName. For example:

<route id="baz">
   <from uri="direct:baz"/>
   <log message="Me Got ${body}" loggingLevel="FATAL" 
   logName="com.mycompany.MyCoolRoute"/>
   <to uri="mock:baz"/>
</route>

Since Camel 2.12.4/2.13.1 it is possible to reference logger instance. For example:

<bean id="myLogger" class="org.slf4j.LoggerFactory" 
factory-method="getLogger" xmlns="http://www.springframework.org/schema/beans">
    <constructor-arg value="com.mycompany.mylogger" />
</bean>
 
<route id="moo" xmlns="http://camel.apache.org/schema/spring">
    <from uri="direct:moo"/>
    <log message="Me Got ${body}" loggingLevel="INFO" loggerRef="myLogger"/>
    <to uri="mock:baz"/>
</route>