I've struggled with this before as well.  Unfortunately, as far as I
can tell the resteasy client APIs have no logging.  When I look at
CXF, you can reuse CXF's logging in/out filter to enable debug of
these messages.  Personally, I use them to help mock out responses
from the server (though I also started persisting the response to
disk).

>From looking at the debug logs, you can technically turn on debug for
the underlying Apache HTTP client libs, and then you can get the raw
request/response.  See below for some output:

1445 [main] DEBUG org.apache.http.wire  - << "HTTP/1.1 200 OK[\r][\n]"
1447 [main] DEBUG org.apache.http.wire  - << "Content-Type: text/plain[\r][\n]"
1447 [main] DEBUG org.apache.http.wire  - << "Content-Length: 4[\r][\n]"
1447 [main] DEBUG org.apache.http.wire  - << "Connection: keep-alive[\r][\n]"
1447 [main] DEBUG org.apache.http.wire  - << "Content-Type: text/plain[\r][\n]"
1447 [main] DEBUG org.apache.http.wire  - << "[\r][\n]"
1448 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection  -
Receiving response: HTTP/1.1 200 OK
1448 [main] DEBUG org.apache.http.headers  - << HTTP/1.1 200 OK
1448 [main] DEBUG org.apache.http.headers  - << Content-Type: text/plain
1448 [main] DEBUG org.apache.http.headers  - << Content-Length: 4
1448 [main] DEBUG org.apache.http.headers  - << Connection: keep-alive
1448 [main] DEBUG org.apache.http.headers  - << Content-Type: text/plain
1451 [main] DEBUG org.apache.http.impl.client.DefaultHttpClient  -
Connection can be kept alive indefinitely
1456 [main] DEBUG org.apache.http.wire  - << "pong"

- John

On Sun, Jan 19, 2014 at 2:54 AM, andrew simpson <andrew10...@gmail.com> wrote:
>
> Hi, I'm using jboss as7.1.1 with arqullian with the following test client
> classes
>
> import javax.ws.rs.client.Client;
> import javax.ws.rs.client.ClientBuilder;
> import javax.ws.rs.client.Entity;
> import javax.ws.rs.client.WebTarget;
> import javax.ws.rs.core.MediaType;
> import javax.ws.rs.core.Response;
>
> I'd like to view the JSON requests and responses going back and forth
> between test client and service under test, ideally body and headers...
>
> I've tried to set up a servlet filter, but this didn't do what I needed.
>
> Can I enable logging directly on the rs client using log4j?
>
> Thanks!
>
> Andrew
>
>
>
>
> rest-easy version:
> <version.org.jboss.resteasy>3.0.4.Final</version.org.jboss.resteasy>
>
> rest-easy dependencies
>
>         <!-- REST -->
>         <dependency>
>             <groupId>org.jboss.resteasy</groupId>
>             <artifactId>resteasy-bom</artifactId>
>             <version>${version.org.jboss.resteasy}</version>
>             <type>pom</type>
>             <scope>provided</scope>
>         </dependency>
>
>         <dependency>
>             <groupId>org.jboss.resteasy</groupId>
>             <artifactId>resteasy-client</artifactId>
>             <version>${version.org.jboss.resteasy}</version>
>             <scope>provided</scope>
>         </dependency>
>
>         <dependency>
>             <groupId>org.jboss.resteasy</groupId>
>             <artifactId>resteasy-jackson-provider</artifactId>
>             <version>${version.org.jboss.resteasy}</version>
>             <scope>provided</scope>
>         </dependency>
>
>         <dependency>
>             <groupId>org.jboss.resteasy</groupId>
>             <artifactId>jaxrs-api</artifactId>
>             <version>${version.org.jboss.resteasy}</version>
>             <scope>provided</scope>
>         </dependency>
>
>         <dependency>
>             <groupId>org.jboss.resteasy</groupId>
>             <artifactId>resteasy-jaxrs</artifactId>
>             <version>${version.org.jboss.resteasy}</version>
>             <scope>provided</scope>
>         </dependency>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to