0

Inside of the debugger I can see

JerseyWebTarget { http://host.com/service/method }

and I see how it builds the parameters and then executes the service.method(parms) call. Can I somehow log the call so that I get the full URL like

http://host.com/service/method?id=5

and also with more complex parameters like a big JSON file that I transfer to the service?

Patrick Rode
  • 120
  • 1
  • 13
  • Please post the code that you have – Ryuzaki L Feb 13 '19 at 11:10
  • you can create your own [Filters and Interceptors](https://jersey.github.io/documentation/latest/filters-and-interceptors.html) to log request – TongChen Feb 13 '19 at 11:22
  • Possible duplicate of [Spring Boot - How to log all requests and responses with exceptions in single place?](https://stackoverflow.com/questions/33744875/spring-boot-how-to-log-all-requests-and-responses-with-exceptions-in-single-pl) – Milan Savaliya Feb 13 '19 at 11:30

1 Answers1

0

Inbuilt spring provides a filter for this purpose. Add below bean to configuration file.

@Bean
public CommonsRequestLoggingFilter requestLoggingFilter() {
    CommonsRequestLoggingFilter loggingFilter = new CommonsRequestLoggingFilter();
    loggingFilter.setIncludeClientInfo(true);
    loggingFilter.setIncludeQueryString(true);
    loggingFilter.setIncludePayload(true);
    return loggingFilter;
}

Also change log level of org.springframework.web.filter.CommonsRequestLoggingFilter to DEBUG.

Alien
  • 15,141
  • 6
  • 37
  • 57
  • I added this Bean to my config. I also put the log level to DEBUG. I am running through a service method then where I have private static final Logger LOG = LoggerFactory.getLogger(Service.class); It does not help. I do not see the call. – Patrick Rode Feb 13 '19 at 12:52