You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rouble <r....@gmail.com> on 2012/12/05 22:38:08 UTC

Enable wire logs on Camel HTTP Proxy

I have a camel route setup to proxy a web service as follows:

        from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
        .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");

How can I see the inbound and outbound HTTP Requests and Responses? I
don't need any other camel logs for my purpose just the wire logs.

tia,
rouble

Re: Enable wire logs on Camel HTTP Proxy

Posted by santhosh <ra...@gmail.com>.
try cxf intercptors -input and output interceptors if its cxf service.It
gives wire incoming msg and wire outgoing msg



--
View this message in context: http://camel.465427.n5.nabble.com/Enable-wire-logs-on-Camel-HTTP-Proxy-tp5723675p5729577.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Enable wire logs on Camel HTTP Proxy

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Dec 5, 2012 at 10:41 PM, Scott England-Sullivan
<su...@gmail.com> wrote:
> The following should allow you to see both:
>
>
> from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>      .log("Request message: ${body}")
>
>  .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false")
>      .log("Response message: ${body}");
>

Mind about streams as if you log the message body, it may not be
re-readable again for the actual response.

See about stream caching
http://camel.apache.org/stream-caching.html

Camel sits on top of 3rd party frameworks. So in these cases they may
offer some logging capabilities for that.
Maybe there is a logger name you can set to DEBUG or TRACE to see the raw data.



> Hope this helps.
>
> Best Regards,
> Scott ES
>
> On Wed, Dec 5, 2012 at 4:38 PM, rouble <r....@gmail.com> wrote:
>
>> I have a camel route setup to proxy a web service as follows:
>>
>>         from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>>
>> .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
>>
>> How can I see the inbound and outbound HTTP Requests and Responses? I
>> don't need any other camel logs for my purpose just the wire logs.
>>
>> tia,
>> rouble
>>
>
>
>
> --
> --
> Scott England-Sullivan
> Apache Camel Committer
> Principal Consultant / Sr. Architect | Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web:     fusesource.com <http://www.fusesource.com> |
> redhat.com<http://www.redhat.com>
> Blog:     sully6768.blogspot.com
> Twitter: sully6768



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Enable wire logs on Camel HTTP Proxy

Posted by Raul Kripalani <ra...@evosent.com>.
Can you show us exactly where you are inserting your log statements?

A log statement between the servlet endpoint and the http4 one should
display what you're after.

Sent while on the move
On 7 Mar 2013 18:36, "rouble" <r....@gmail.com> wrote:

> Willem, Scott, Claus et al,
>
> Appreciate all your input. So, is there no "camel way" to get the logs
> from the client to the camel proxy? Or do I have to look at the web
> container (tomcat or Jetty) logs?
>
> Here is my topology:
> Client<====>Camel Proxy<====>Remote Endpoint
>
> And my simple route:
>         from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>
> .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
>
> Adding .log() statements will get me the logs from camel proxy to the
> remote endpoint. But not from the Client to the Camel Proxy.
>
> I would really like to generate all the wire HTTP logs within the
> camel proxy itself. On the topic of stream caching, I want to be able
> to turn on these wire HTTP logs at DEBUG level. Is it possibly to
> programmatically enable stream caching and logging?
>
> Cheers
> Rouble
>
> On Mon, Mar 4, 2013 at 8:47 PM, Willem jiang <wi...@gmail.com>
> wrote:
> > If you are using Jetty, I think you can find out the HTTP log somewhere.
> > And Scott just show you how to log the request and response message in
> the camel route.
> >
> >
> > --
> > Willem Jiang
> >
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Web: http://www.fusesource.com | http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> (English)
> >           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> >
> >
> >
> > On Tuesday, March 5, 2013 at 4:49 AM, rouble wrote:
> >
> >> [Re-viving old thread]
> >>
> >> So this shows the communication between the camel proxy box and the
> >> remote endpoint.
> >>
> >> How do I see the HTTP logs between the client and the camel proxy box?
> >>
> >> Basically, the network topology is Client<=========>Camel
> >> Proxy<===========>Remote Endpoint
> >>
> >> tia,
> >> rouble
> >>
> >> > The following should allow you to see both:
> >> >
> >> >
> >> > from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
> >> > .log("Request message: ${body}")
> >> >
> >> >
> .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false")
> >> > .log("Response message: ${body}");
> >> >
> >> > Hope this helps.
> >> >
> >> > Best Regards,
> >> > Scott ES
> >> >
> >> > On Wed, Dec 5, 2012 at 4:38 PM, rouble <r.ouble@gmail.com (mailto:
> r.ouble@gmail.com)> wrote:
> >> >
> >> > > I have a camel route setup to proxy a web service as follows:
> >> > >
> >> > > from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
> >> > >
> >> > >
> .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
> >> > >
> >> > > How can I see the inbound and outbound HTTP Requests and Responses?
> I
> >> > > don't need any other camel logs for my purpose just the wire logs.
> >> > >
> >> > > tia,
> >> > > rouble
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > --
> >> > Scott England-Sullivan
> >> > Apache Camel Committer
> >> > Principal Consultant / Sr. Architect | Red Hat, Inc.
> >> > FuseSource is now part of Red Hat
> >> > Web: fusesource.com <http://www.fusesource.com> |
> >> > redhat.com<http://www.redhat.com>
> >> > Blog: sully6768.blogspot.com (http://sully6768.blogspot.com)
> >> > Twitter: sully6768
> >>
> >
> >
> >
>

Re: Enable wire logs on Camel HTTP Proxy

Posted by Willem jiang <wi...@gmail.com>.
Hi

As you are using Servlet transport, I think you may consider to setup the log of web container.
They you can get to whole picture of wire HTTP logs between the client and Camel Proxy.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Friday, March 8, 2013 at 2:35 AM, rouble wrote:

> Willem, Scott, Claus et al,
>  
> Appreciate all your input. So, is there no "camel way" to get the logs
> from the client to the camel proxy? Or do I have to look at the web
> container (tomcat or Jetty) logs?
>  
> Here is my topology:
> Client<====>Camel Proxy<====>Remote Endpoint
>  
> And my simple route:
> from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
> .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
>  
> Adding .log() statements will get me the logs from camel proxy to the
> remote endpoint. But not from the Client to the Camel Proxy.
>  
> I would really like to generate all the wire HTTP logs within the
> camel proxy itself. On the topic of stream caching, I want to be able
> to turn on these wire HTTP logs at DEBUG level. Is it possibly to
> programmatically enable stream caching and logging?
>  
> Cheers
> Rouble
>  
> On Mon, Mar 4, 2013 at 8:47 PM, Willem jiang <willem.jiang@gmail.com (mailto:willem.jiang@gmail.com)> wrote:
> > If you are using Jetty, I think you can find out the HTTP log somewhere.
> > And Scott just show you how to log the request and response message in the camel route.
> >  
> >  
> > --
> > Willem Jiang
> >  
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Web: http://www.fusesource.com | http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
> > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >  
> >  
> >  
> >  
> > On Tuesday, March 5, 2013 at 4:49 AM, rouble wrote:
> >  
> > > [Re-viving old thread]
> > >  
> > > So this shows the communication between the camel proxy box and the
> > > remote endpoint.
> > >  
> > > How do I see the HTTP logs between the client and the camel proxy box?
> > >  
> > > Basically, the network topology is Client<=========>Camel
> > > Proxy<===========>Remote Endpoint
> > >  
> > > tia,
> > > rouble
> > >  
> > > > The following should allow you to see both:
> > > >  
> > > >  
> > > > from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
> > > > .log("Request message: ${body}")
> > > >  
> > > > .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false")
> > > > .log("Response message: ${body}");
> > > >  
> > > > Hope this helps.
> > > >  
> > > > Best Regards,
> > > > Scott ES
> > > >  
> > > > On Wed, Dec 5, 2012 at 4:38 PM, rouble <r.ouble@gmail.com (mailto:r.ouble@gmail.com)> wrote:
> > > >  
> > > > > I have a camel route setup to proxy a web service as follows:
> > > > >  
> > > > > from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
> > > > >  
> > > > > .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
> > > > >  
> > > > > How can I see the inbound and outbound HTTP Requests and Responses? I
> > > > > don't need any other camel logs for my purpose just the wire logs.
> > > > >  
> > > > > tia,
> > > > > rouble
> > > >  
> > > >  
> > > >  
> > > >  
> > > >  
> > > >  
> > > >  
> > > > --
> > > > --
> > > > Scott England-Sullivan
> > > > Apache Camel Committer
> > > > Principal Consultant / Sr. Architect | Red Hat, Inc.
> > > > FuseSource is now part of Red Hat
> > > > Web: fusesource.com <http://www.fusesource.com> |
> > > > redhat.com<http://www.redhat.com>
> > > > Blog: sully6768.blogspot.com (http://sully6768.blogspot.com)
> > > > Twitter: sully6768
> > >  
> >  
>  




Re: Enable wire logs on Camel HTTP Proxy

Posted by rouble <r....@gmail.com>.
Willem, Scott, Claus et al,

Appreciate all your input. So, is there no "camel way" to get the logs
from the client to the camel proxy? Or do I have to look at the web
container (tomcat or Jetty) logs?

Here is my topology:
Client<====>Camel Proxy<====>Remote Endpoint

And my simple route:
        from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
        .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");

Adding .log() statements will get me the logs from camel proxy to the
remote endpoint. But not from the Client to the Camel Proxy.

I would really like to generate all the wire HTTP logs within the
camel proxy itself. On the topic of stream caching, I want to be able
to turn on these wire HTTP logs at DEBUG level. Is it possibly to
programmatically enable stream caching and logging?

Cheers
Rouble

On Mon, Mar 4, 2013 at 8:47 PM, Willem jiang <wi...@gmail.com> wrote:
> If you are using Jetty, I think you can find out the HTTP log somewhere.
> And Scott just show you how to log the request and response message in the camel route.
>
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
> On Tuesday, March 5, 2013 at 4:49 AM, rouble wrote:
>
>> [Re-viving old thread]
>>
>> So this shows the communication between the camel proxy box and the
>> remote endpoint.
>>
>> How do I see the HTTP logs between the client and the camel proxy box?
>>
>> Basically, the network topology is Client<=========>Camel
>> Proxy<===========>Remote Endpoint
>>
>> tia,
>> rouble
>>
>> > The following should allow you to see both:
>> >
>> >
>> > from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>> > .log("Request message: ${body}")
>> >
>> > .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false")
>> > .log("Response message: ${body}");
>> >
>> > Hope this helps.
>> >
>> > Best Regards,
>> > Scott ES
>> >
>> > On Wed, Dec 5, 2012 at 4:38 PM, rouble <r.ouble@gmail.com (mailto:r.ouble@gmail.com)> wrote:
>> >
>> > > I have a camel route setup to proxy a web service as follows:
>> > >
>> > > from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>> > >
>> > > .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
>> > >
>> > > How can I see the inbound and outbound HTTP Requests and Responses? I
>> > > don't need any other camel logs for my purpose just the wire logs.
>> > >
>> > > tia,
>> > > rouble
>> >
>> >
>> >
>> >
>> >
>> > --
>> > --
>> > Scott England-Sullivan
>> > Apache Camel Committer
>> > Principal Consultant / Sr. Architect | Red Hat, Inc.
>> > FuseSource is now part of Red Hat
>> > Web: fusesource.com <http://www.fusesource.com> |
>> > redhat.com<http://www.redhat.com>
>> > Blog: sully6768.blogspot.com (http://sully6768.blogspot.com)
>> > Twitter: sully6768
>>
>
>
>

Re: Enable wire logs on Camel HTTP Proxy

Posted by Willem jiang <wi...@gmail.com>.
If you are using Jetty, I think you can find out the HTTP log somewhere.
And Scott just show you how to log the request and response message in the camel route.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem




On Tuesday, March 5, 2013 at 4:49 AM, rouble wrote:

> [Re-viving old thread]
>  
> So this shows the communication between the camel proxy box and the
> remote endpoint.
>  
> How do I see the HTTP logs between the client and the camel proxy box?
>  
> Basically, the network topology is Client<=========>Camel
> Proxy<===========>Remote Endpoint
>  
> tia,
> rouble
>  
> > The following should allow you to see both:
> >  
> >  
> > from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
> > .log("Request message: ${body}")
> >  
> > .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false")
> > .log("Response message: ${body}");
> >  
> > Hope this helps.
> >  
> > Best Regards,
> > Scott ES
> >  
> > On Wed, Dec 5, 2012 at 4:38 PM, rouble <r.ouble@gmail.com (mailto:r.ouble@gmail.com)> wrote:
> >  
> > > I have a camel route setup to proxy a web service as follows:
> > >  
> > > from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
> > >  
> > > .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
> > >  
> > > How can I see the inbound and outbound HTTP Requests and Responses? I
> > > don't need any other camel logs for my purpose just the wire logs.
> > >  
> > > tia,
> > > rouble
> >  
> >  
> >  
> >  
> >  
> > --
> > --
> > Scott England-Sullivan
> > Apache Camel Committer
> > Principal Consultant / Sr. Architect | Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Web: fusesource.com <http://www.fusesource.com> |
> > redhat.com<http://www.redhat.com>
> > Blog: sully6768.blogspot.com (http://sully6768.blogspot.com)
> > Twitter: sully6768
>  




Re: Enable wire logs on Camel HTTP Proxy

Posted by rouble <r....@gmail.com>.
[Re-viving old thread]

So this shows the communication between the camel proxy box and the
remote endpoint.

How do I see the HTTP logs between the client and the camel proxy box?

Basically, the network topology is Client<=========>Camel
Proxy<===========>Remote Endpoint

tia,
rouble

> The following should allow you to see both:
>
>
> from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>      .log("Request message: ${body}")
>
>  .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false")
>      .log("Response message: ${body}");
>
> Hope this helps.
>
> Best Regards,
> Scott ES
>
> On Wed, Dec 5, 2012 at 4:38 PM, rouble <r....@gmail.com> wrote:
>
>> I have a camel route setup to proxy a web service as follows:
>>
>>         from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>>
>> .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
>>
>> How can I see the inbound and outbound HTTP Requests and Responses? I
>> don't need any other camel logs for my purpose just the wire logs.
>>
>> tia,
>> rouble
>>
>
>
>
> --
> --
> Scott England-Sullivan
> Apache Camel Committer
> Principal Consultant / Sr. Architect | Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web:     fusesource.com <http://www.fusesource.com> |
> redhat.com<http://www.redhat.com>
> Blog:     sully6768.blogspot.com
> Twitter: sully6768

Re: Enable wire logs on Camel HTTP Proxy

Posted by Scott England-Sullivan <su...@gmail.com>.
The following should allow you to see both:


from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
     .log("Request message: ${body}")

 .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false")
     .log("Response message: ${body}");

Hope this helps.

Best Regards,
Scott ES

On Wed, Dec 5, 2012 at 4:38 PM, rouble <r....@gmail.com> wrote:

> I have a camel route setup to proxy a web service as follows:
>
>         from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>
> .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
>
> How can I see the inbound and outbound HTTP Requests and Responses? I
> don't need any other camel logs for my purpose just the wire logs.
>
> tia,
> rouble
>



-- 
-- 
Scott England-Sullivan
Apache Camel Committer
Principal Consultant / Sr. Architect | Red Hat, Inc.
FuseSource is now part of Red Hat
Web:     fusesource.com <http://www.fusesource.com> |
redhat.com<http://www.redhat.com>
Blog:     sully6768.blogspot.com
Twitter: sully6768