users@jersey.java.net

[Jersey] Re: Enable Tracing

From: Libor Kramolis <libor.kramolis_at_oracle.com>
Date: Fri, 9 May 2014 09:02:07 +0200

Hello Eric.
No, it should be enough to set mentioned properties.
-lk



On 07 May 2014, at 15:32, Eric Stein <steine_at_locustec.com> wrote:
> Libor,
> Thanks for replying. I did actually find your blog post .. it was the link I provided in my first email. The post was very well done, and I tried to follow it. I somehow managed to get it working without the Debug feature set - I think maybe cleaning the project did it. I'm still not seeing the trace in the headers, though. Was there something else I needed to set besides those two properties (Tracing = ALL, Tracing_Threshold=VERBOSE)?
>
> Eric
>
> From: Libor Kramolis [mailto:libor.kramolis_at_oracle.com]
> Sent: Tuesday, May 06, 2014 5:20 PM
> To: users_at_jersey.java.net
> Subject: [Jersey] Re: Enable Tracing
>
> Hello.
>
> I have written blog post about configuring tracing support - http://yatel.kramolis.cz/2013/11/jersey-2-tracing-support.html.
>
> I expect ‘com.sun.jersey.config...’ properties are Jersey 1 specific. Do not you combine both Jersey versions? You can be inspired by unit tests: https://github.com/jersey/jersey/tree/736dd8c2d000c037bcb711d76290da8456d49446/tests/integration/tracing-support/src/main/java/org/glassfish/jersey/tests/integration/tracing.
>
> -lk
>
>
>
> On 06 May 2014, at 20:32, Eric Stein <steine_at_locustec.com> wrote:
>
>
> It looks like if I set the VM property
> -Dcom.sun.jersey.config.feature.Debug=true
>
> I get the log messages in the log file, but still not in the headers. Is there any way to set the Debug feature to true within the scope of the ResourceConfig?
>
> From: Eric Stein
> Sent: Tuesday, May 06, 2014 2:09 PM
> To: users_at_jersey.java.net
> Subject: Enable Tracing
>
> I'm running Jersey 2.4 and trying to enable tracing. My ResourceConfig looks like:
>
> public MyResourceConfig() {
> super();
>
> this.registerClasses(
> JacksonFeature.class,
> JsonFactoryResolver.class);
> this.registerClasses(
> QueryResource.class);
> this.registerClasses(
> RuntimeExceptionMapper.class);
> this.registerClasses(
> LoggingFilter.class);
>
> final Map<String, Object> properties = new HashMap<String, Object>();
> properties.put("com.sun.jersey.api.json.POJOMappingFeature", Boolean.TRUE);
> properties.put("com.sun.jersey.config.feature.Debug", Boolean.TRUE);
> properties.put(ServerProperties.TRACING, "ALL");
> properties.put(ServerProperties.TRACING_THRESHOLD, "VERBOSE");
> this.addProperties(properties);
> }
>
> My JerseyTest instance returns a MyResourceConfig instance from configure(). When I run my tests, though, I don't see any trace logged to my console and there's nothing in the headers:
>
> response.getHeaders() : {Date=[Tue, 06 May 2014 17:56:52 GMT], Content-Length=[90], Content-Type=[application/json]}
>
> What am I doing wrong?
>
> Also, is there any way to configure tracing to *only* log and *not* return the headers? I expect the answer is no, but it can't hurt to ask.
>
> Thanks,
> Eric