If you want to turn on logging on the server side, you need to register the LoggingFilter Jersey filter (on the container side).
This filter will log request/response headers and entities.
Here's what you need to add to your ResourceConfig
class:
@ApplicationPath("/")
public class MyApplication extends ResourceConfig {
public MyApplication() {
// Resources.
packages(MyResource.class.getPackage().getName());
register(LoggingFilter.class);
}
}
Note that the same filter also works on the client side.
Client client = Client.create();
client.addFilter(new LoggingFilter());
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…