You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by honghebox <ao...@gmail.com> on 2012/01/26 22:00:25 UTC

help with log DSL

I'm trying to log message body using something like:

from ("jms:mytestqueue").
setBody().simple("Say Hello").
.log(LoggingLevel.DEBUG, "Message body: ${body}")
..............................

In my log file, instead of seeing "Message body: Say Hello" I got "Message
body: ${body}", any extra configuration I need to do get the ${body} place
holder work?

Thanks in advance.




--
View this message in context: http://camel.465427.n5.nabble.com/help-with-log-DSL-tp5433969p5433969.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: help with log DSL

Posted by Rich Newcomb <ri...@gmail.com>.
You can use the .log in your routes, via the log EIP (
http://camel.apache.org/logeip.html).

I tested the route segment supplied in the original message (via
Camel 2.6.0-fuse-01-09) ::

   .setBody().simple("Say Hello")

   .log(LoggingLevel.DEBUG, "Message body: ${body}")

.. and it works as expected.   Original poster  -- I think there must be
some trivial problem with your code -- such as a '(' used instead of a '}'.

Please copy & paste the code snippet directly from your IDE if you can not
find the problem.


On Thu, Jan 26, 2012 at 1:41 PM, Chris Odom <ch...@mediadriver.com>wrote:

> Sorry was thinking Spring/Blueprint not Java DSL.
>
> you cant not really do a .log() in Java DSL you need to use a .to()
>
> go look at http://camel.apache.org/log.html
>
> try .to("log:PACKAGE?level=DEBUG&amp;showBody=true")
>
> where PACKAGE is the java package space for logging. ex:
> log:com.national?...
>
> --
> Thanks,
> Chris Odom
> 512:799-0270
>

Re: help with log DSL

Posted by Chris Odom <ch...@mediadriver.com>.
Sorry was thinking Spring/Blueprint not Java DSL.

you cant not really do a .log() in Java DSL you need to use a .to()

go look at http://camel.apache.org/log.html

try .to("log:PACKAGE?level=DEBUG&amp;showBody=true")

where PACKAGE is the java package space for logging. ex:
log:com.national?...

-- 
Thanks,
Chris Odom
512:799-0270

Re: help with log DSL

Posted by honghebox <ao...@gmail.com>.
No, without quotations around ${body}, you code even won't compile.

--
View this message in context: http://camel.465427.n5.nabble.com/help-with-log-DSL-tp5433969p5433989.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: help with log DSL

Posted by Chris Odom <ch...@mediadriver.com>.
Looks like you have Quotations around the ${body} making it literal, try
"Message body: "+${body} instead....

Hope this helps


On Thu, 26 Jan 2012 13:00:25 -0800 (PST), honghebox <ao...@gmail.com>
wrote:
> I'm trying to log message body using something like:
> 
> from ("jms:mytestqueue").
> setBody().simple("Say Hello").
> .log(LoggingLevel.DEBUG, "Message body: ${body}")
> ..............................
> 
> In my log file, instead of seeing "Message body: Say Hello" I got
"Message
> body: ${body}", any extra configuration I need to do get the ${body}
place
> holder work?
> 
> Thanks in advance.
> 
> 
> 
> 
> --
> View this message in context:
>
http://camel.465427.n5.nabble.com/help-with-log-DSL-tp5433969p5433969.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

-- 
Thanks,
Chris Odom
512:799-0270