如何启用 spring boot 1.2.5,使用 jersey,打印原始 http 请求和对控制台的响应?
How can I enable spring boot 1.2.5, using jersey, to print the raw http request and response to the console?
我有一个使用 jersey 2 的 spring boot 1.2.5 服务。我在自己的日志中看到了请求,但我也想在控制台中看到原始的 http 请求和响应。如何打开将 http 流量打印到控制台?
import java.util.logging.Logger;
import org.glassfish.jersey.filter.LoggingFilter;
import javax.ws.rs.ApplicationPath;
import org.springframework.stereotype.Component;
@Component
@ApplicationPath("/")
public class JerseyConfiguration extends ResourceConfig {
private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());
public JerseyConfiguration() {
...
register(new LoggingFilter(log, true));
}
}
我有一个使用 jersey 2 的 spring boot 1.2.5 服务。我在自己的日志中看到了请求,但我也想在控制台中看到原始的 http 请求和响应。如何打开将 http 流量打印到控制台?
import java.util.logging.Logger;
import org.glassfish.jersey.filter.LoggingFilter;
import javax.ws.rs.ApplicationPath;
import org.springframework.stereotype.Component;
@Component
@ApplicationPath("/")
public class JerseyConfiguration extends ResourceConfig {
private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());
public JerseyConfiguration() {
...
register(new LoggingFilter(log, true));
}
}