users@jersey.java.net

[Jersey] Re: Enable Tracing

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

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