How to get jersey logs at server?

后端 未结 5 1320
时光取名叫无心
时光取名叫无心 2020-11-28 05:36

I am using jersey for a REST WS. How do I enable jersey logs at server side?

Long story: I get a clientside exception - but I don\'t see anything in tomcat logs [It

5条回答
  •  佛祖请我去吃肉
    2020-11-28 06:01

    Jersey 2 has deprecated LoggingFilter and you now need to use LoggingFeature. In order to use it with a client you can use the following snipette:

    this.client = ClientBuilder
                .newBuilder()
                .property(LoggingFeature.LOGGING_FEATURE_VERBOSITY_CLIENT, LoggingFeature.Verbosity.PAYLOAD_ANY)
                .property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_CLIENT, "WARNING")
                .build();
    

    and on the server side:

    ResourceConfig config = new ResourceConfig(HelloWorldResource.class);
    config.register(LoggingFeature.class);
    

提交回复
热议问题