You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Yacov Schondorf <ya...@gmail.com> on 2018/01/28 19:40:40 UTC

Unable to view message body

Hi,
I am trying to log the contents of a message using the log component.
Following is my route:

from("jetty://http://localhost:8099/myApi
").noStreamCaching().to("log:myCategory?level=DEBUG&showBody=true&showHeaders=true");

Although I used noStreamCaching() in the route, and specified
showBody=true, I do not see the message body. Instead, I see:
Body: [Body is instance of org.apache.camel.StreamCache]

I run following commands from Firefox development console in order to test
the route:

var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '
https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'
document.head.appendChild(script);
$.ajax({
    url: "http://localhost:8099/myApi",
    headers: {
        "Content-Type":"application/json"
    },
    method: "POST",
    dataType: "json",
    data: "{\
    'foo': 'bar'\
}"
})

Any ideas what I am doing wrong?

RE: Re: Unable to view message body

Posted by "Schondorf, Yacov" <ys...@forcepoint.com>.
Thanks. Works like a charm!

-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Sent: Monday, January 29, 2018 12:01 PM
To: users@camel.apache.org
Subject: EXTERNAL: Re: Unable to view message body

Hi

See the showStreams option
http://camel.apache.org/log

On Sun, Jan 28, 2018 at 8:40 PM, Yacov Schondorf <ya...@gmail.com> wrote:
> Hi,
> I am trying to log the contents of a message using the log component.
> Following is my route:
>
> from("jetty://http://localhost:8099/myApi
> ").noStreamCaching().to("log:myCategory?level=DEBUG&showBody=true&show
> Headers=true");
>
> Although I used noStreamCaching() in the route, and specified 
> showBody=true, I do not see the message body. Instead, I see:
> Body: [Body is instance of org.apache.camel.StreamCache]
>
> I run following commands from Firefox development console in order to 
> test the route:
>
> var script = document.createElement('script'); script.type = 
> 'text/javascript'; script.src = '
> https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'
> document.head.appendChild(script);
> $.ajax({
>     url: "http://localhost:8099/myApi",
>     headers: {
>         "Content-Type":"application/json"
>     },
>     method: "POST",
>     dataType: "json",
>     data: "{\
>     'foo': 'bar'\
> }"
> })
>
> Any ideas what I am doing wrong?



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Unable to view message body

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See the showStreams option
http://camel.apache.org/log

On Sun, Jan 28, 2018 at 8:40 PM, Yacov Schondorf
<ya...@gmail.com> wrote:
> Hi,
> I am trying to log the contents of a message using the log component.
> Following is my route:
>
> from("jetty://http://localhost:8099/myApi
> ").noStreamCaching().to("log:myCategory?level=DEBUG&showBody=true&showHeaders=true");
>
> Although I used noStreamCaching() in the route, and specified
> showBody=true, I do not see the message body. Instead, I see:
> Body: [Body is instance of org.apache.camel.StreamCache]
>
> I run following commands from Firefox development console in order to test
> the route:
>
> var script = document.createElement('script');
> script.type = 'text/javascript';
> script.src = '
> https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'
> document.head.appendChild(script);
> $.ajax({
>     url: "http://localhost:8099/myApi",
>     headers: {
>         "Content-Type":"application/json"
>     },
>     method: "POST",
>     dataType: "json",
>     data: "{\
>     'foo': 'bar'\
> }"
> })
>
> Any ideas what I am doing wrong?



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2