1

I am using the Jersey client to communicate with a remote server. I do not have access to this server's logs. Therefore, it's essential that I see what I'm sending over from the client in order to troubleshoot my code. How can I increase logging to see at least:

  1. The url I'm sending a request to
  2. The parameter values
  3. Headers
  4. The request body (assuming I'm posting)
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
  • possible duplicate of [Jersey: Print the actual request](http://stackoverflow.com/questions/6860661/jersey-print-the-actual-request) – Daniel Kaplan Jan 07 '15 at 19:41

1 Answers1

2

have you tried looking at LoggingFilter

abinsalm
  • 66
  • 8
  • Do you have any sample code that shows how to use this? – Daniel Kaplan Jan 07 '15 at 18:51
  • 1
    have a look at https://stackoverflow.com/questions/2332515/how-to-get-jersey-logs-at-server and http://stackoverflow.com/questions/6860661/jersey-print-the-actual-request/6873911#6873911 – abinsalm Jan 07 '15 at 19:31
  • That second link is pretty much of a duplicate of my question. I'm going to vote to close this. Thanks for the help. – Daniel Kaplan Jan 07 '15 at 19:41
  • Actually, now that I've tried that, I notice that `addFilter` doesn't exist on the `Client` in jersey 2.x. – Daniel Kaplan Jan 07 '15 at 19:51
  • 1
    do you use ClientBuilder to create your client? it has a method register which you can use it to register your LoggingFilter like this: `Client client = ClientBuilder.newClient().register(LoggingFilter.class);` Not tested though – abinsalm Jan 07 '15 at 20:10