Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP request logging #107

Open
penberg opened this issue May 29, 2020 · 1 comment
Open

HTTP request logging #107

penberg opened this issue May 29, 2020 · 1 comment
Milestone

Comments

@penberg
Copy link
Contributor

penberg commented May 29, 2020

As I am debugging a JMX startup hang (#100), I need more visibility into what the JMX proxy is doing internally.

I wanted to trace HTTP requests, but I am unable to get anything out of Jersey, even with the LoggingFeature capability in Jersey 2.30.1:

diff --git a/scylla-apiclient/src/main/java/com/scylladb/jmx/api/APIClient.java b/scylla-apiclient/src/main/java/com/scylladb/jmx/api/APIClient.java
index 8bc7ddc..5b5d86c 100644
--- a/scylla-apiclient/src/main/java/com/scylladb/jmx/api/APIClient.java
+++ b/scylla-apiclient/src/main/java/com/scylladb/jmx/api/APIClient.java
@@ -37,6 +37,8 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;

 import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.logging.LoggingFeature;
+import java.util.logging.Level;

 import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import com.scylladb.jmx.utils.SnapshotDetailsTabularData;
@@ -54,7 +56,12 @@ public class APIClient {
         this.config = config;
         this.clientConfig = new ClientConfig();
         clientConfig.register(new JacksonJaxbJsonProvider());
-        this.client = ClientBuilder.newClient(clientConfig);
+        LoggingFeature feature = new LoggingFeature(logger, Level.INFO, LoggingFeature.Verbosity.PAYLOAD_TEXT, 8192);
+        this.client = ClientBuilder
+               .newBuilder()
+               .withConfig(clientConfig)
+               .register(feature)
+               .build();
     }

     private String getCacheKey(String key, MultivaluedMap<String, String> param, long duration) {

@tarzanek, @amnonh, any ideas how to get this working?

@tarzanek
Copy link
Contributor

tarzanek commented Jun 9, 2020

adding sample from Amnon:
"
Example a log.properties file I used myself as an example
you should add to the java command line
-Djava.util.logging.config.file=log.properties

I believe the scylla-jmx passes all -D command line variables to the internal java, so it should work (I've edited the scylla-jmx locally and added it to the java call part so I will not need to remember how to do it).

so it should work by calling:
scylla-jmx -Djava.util.logging.config.file=log.properties
"
log.properties.txt

@DoronArazii DoronArazii added this to the Backlog milestone May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants