How to enable tracing in unit test using ResourceTestRule?

I use dropwizard with a t-shirt. I have a problem with the path in the resource and would like to debug it. How do you set up a jersey environment variable for this? Does not work.

@ClassRule public static final ResourceTestRule resources = ResourceTestRule.builder() .addResource(UserResource.class) .addProperty("jersey.config.server.tracing.type", "ON") .build(); 
+7
dropwizard
source share
1 answer

The following call to ResourceTestRule sets the default registration with the WARN level:

 static { BootstrapLogging.bootstrap(); } 

To override, I call BootstrapLogging again and specify the required logging level in my test class after creating the ResourceTestRule , for example:

 import ch.qos.logback.classic.Level; import io.dropwizard.logging.BootstrapLogging; ... @ClassRule public static final ResourceTestRule resources = ResourceTestRule.builder() .addResource(UserResource.class) .build(); static { BootstrapLogging.bootstrap(Level.DEBUG); } 

Then I can see the log output in the console.

+4
source share

All Articles