Chip Chip -4 years ago 209
HTTP Question

How can I enable spring boot 1.2.5, using jersey, to print the raw http request and response to the console?

I have a spring boot 1.2.5 service that uses jersey 2. I see the requests in my own logs but I'd like to see the raw http request and response in the console as well. How can you turn on printing http traffic to the console?

Answer Source
import java.util.logging.Logger;
import org.glassfish.jersey.filter.LoggingFilter;
import org.springframework.stereotype.Component;

public class JerseyConfiguration extends ResourceConfig {
    private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());

    public JerseyConfiguration() {

        register(new LoggingFilter(log, true));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download