I am using jersey rest api (JAX-RS) of 2.25.1 version. I tried to use LoggingFeature class at server side and as well as client side.
Client side code:
public static void getOperation() {
ClientConfig config = new ClientConfig();
config.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY_CLIENT, LoggingFeature.Verbosity.PAYLOAD_ANY);
config.register(new LoggingFeature(logger, LoggingFeature.Verbosity.PAYLOAD_ANY));
Client client = ClientBuilder.newClient(config);
client.register(ClientEmpReqFilter.class);
client.register(ClientEmpResFilter.class);
WebTarget target = client.target("http://localhost:8080").path("restappln/rest/entity");
String str = target.request(MediaType.APPLICATION_JSON).get(String.class);
System.out.println(str);
}
and Server-side code is :
@ApplicationPath("/rest")
public class MyApplication extends ResourceConfig {
public MyApplication() {
packages("<package name>");
register(LoggingFeature.class);
}
}
I am not able to get logging. I am passing instance of java.util.Logger to the contructor of client config.
config.register(new LoggingFeature(logger, LoggingFeature.Verbosity.PAYLOAD_ANY));