From: Ben Soares Date: Mon, 5 Jun 2023 19:26:42 +0000 (+0100) Subject: JAL-4001 debugging statements X-Git-Tag: Release_2_11_4_0~277 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7f2fffff9499545aff4f6189455b21ce1fa50501;p=jalview.git JAL-4001 debugging statements --- diff --git a/src/jalview/analytics/GoogleAnalytics4.java b/src/jalview/analytics/GoogleAnalytics4.java index bf6f3f3..3997543 100644 --- a/src/jalview/analytics/GoogleAnalytics4.java +++ b/src/jalview/analytics/GoogleAnalytics4.java @@ -74,19 +74,24 @@ public class GoogleAnalytics4 addJsonValue("client_id", CLIENT_ID); addJsonValues("events", Event.toObjectList(events)); // addJsonValue("events", ) - StringBuilder sb = new StringBuilder(); - sb.append(BASE_URL); - sb.append('?'); - sb.append(buildQueryString()); + StringBuilder urlSb = new StringBuilder(); + urlSb.append(BASE_URL); + urlSb.append('?'); + urlSb.append(buildQueryString()); try { - URL url = new URL(sb.toString()); + URL url = new URL(urlSb.toString()); URLConnection urlConnection = url.openConnection(); HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection; httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoOutput(true); - byte[] jsonBytes = buildJson().getBytes(StandardCharsets.UTF_8); + String jsonString = buildJson(); + + Console.debug("##### HTTP Request is: '" + urlSb.toString() + "'"); + Console.debug("##### POSTed JSON is:\n" + jsonString); + + byte[] jsonBytes = jsonString.getBytes(StandardCharsets.UTF_8); int jsonLength = jsonBytes.length; httpURLConnection.setFixedLengthStreamingMode(jsonLength);