简体   繁体   English

如何在Camel Spring DSL中记录消息?

[英]How to log messages in Camel Spring DSL?

I'm using Camel 2.9.2 and defined OnCompletion route as follow: 我正在使用Camel 2.9.2并按如下方式定义OnCompletion路由:

            <onCompletion onFailureOnly="true">
            <log message="Nack On Failure:Status=$simple{header.CXAckStatus}:Error=$simple{header.CXAckError}" loggingLevel="DEBUG"/>
            <process ref="ackMessageProcessor" />
            <to uri="file://{{file.writer.dir}}"/>                      
           </onCompletion>

Provided in 提供于
https://stackoverflow.com/questions/18877562/how-can-i-log-a-header-value-in-camel-using-spring-dsl solution for some reason doesn't work for me. 由于某些原因, https://stackoverflow.com/questions/18877562/how-can-i-log-a-header-value-in-camel-using-spring-dsl解决方案对我不起作用。

I can see some Camel traces relating to route definition Line 5309: 2017-07-28 11:14:53,830 DEBUG [Thread-11] (RouteService.java:311) - Starting child service on route: writingRoute -> OnCompletionProcessor[UnitOfWork(UnitOfWork(RouteContextProcessor[Pipeline[[Channel[Log(writingRoute)[Nack On Failure:Status=$simple{header.CXAckStatus}:Error=$simple{header.CXAckError}]], Channel[sendTo(Endpoint[log://'Ack On Success:Status=$simple{header.CXAckStatus}:Error=$simple{header.CXAckError}' ])], but there is no actual logged message with header values to be found... 我可以看到一些与路线定义有关的骆驼踪迹Line 5309: 2017-07-28 11:14:53,830 DEBUG [Thread-11] (RouteService.java:311) - Starting child service on route: writingRoute -> OnCompletionProcessor[UnitOfWork(UnitOfWork(RouteContextProcessor[Pipeline[[Channel[Log(writingRoute)[Nack On Failure:Status=$simple{header.CXAckStatus}:Error=$simple{header.CXAckError}]], Channel[sendTo(Endpoint[log://'Ack On Success:Status=$simple{header.CXAckStatus}:Error=$simple{header.CXAckError}' ])],但没有找到包含标题值的实际记录消息...

Is anything else I need to configure. 还有什么我需要配置的。

As per documentation, http://camel.apache.org/simple.html . 根据文档, http://camel.apache.org/simple.html

$simple{} is for versions before 2.9.2. $ simple {}适用于2.9.2之前的版本。 and ${} thereafter. 然后是$ {}。

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

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