users@jersey.java.net

[Jersey] Enable Tracing

From: Eric Stein <steine_at_locustec.com>
Date: Tue, 6 May 2014 18:09:12 +0000

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