asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Till Westmann (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: log request in QueryServiceServlet
Date Fri, 30 Sep 2016 19:00:35 GMT
Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1232

Change subject: log request in QueryServiceServlet
......................................................................

log request in QueryServiceServlet

Change-Id: Iceb265553bd20f4ab964a769892169f2c62e44a4
---
M asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
2 files changed, 19 insertions(+), 1 deletion(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/32/1232/1

diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
index c7adc25..427e177 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
@@ -226,6 +226,23 @@
         String format;
         boolean pretty;
         String clientContextID;
+
+        @Override
+        public String toString() {
+            return append(new StringBuilder()).toString();
+        }
+
+        public StringBuilder append(final StringBuilder sb) {
+            sb.append("{ ");
+            sb.append("\"statement\": \"");
+            JSONUtil.escape(sb, statement);
+            sb.append("\", ");
+            sb.append("\"format\": \"").append(format).append("\", ");
+            sb.append("\"pretty\": ").append(pretty).append(", ");
+            sb.append("\"clientContextID\": \"").append(clientContextID).append("\" ");
+            sb.append('}');
+            return sb;
+        }
     }
 
     private static String getParameterValue(String content, String attribute) {
@@ -426,6 +443,7 @@
     }
 
     private void handleRequest(RequestParameters param, HttpServletResponse response) throws
IOException {
+        LOGGER.info(param.toString());
         long elapsedStart = System.nanoTime();
         final StringWriter stringWriter = new StringWriter();
         final PrintWriter resultWriter = new PrintWriter(stringWriter);
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
index 0b973e1..fd89c5e 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
@@ -112,7 +112,7 @@
         return escape(new StringBuilder(), str).toString();
     }
 
-    private static StringBuilder escape(StringBuilder sb, String str) {
+    public static StringBuilder escape(StringBuilder sb, String str) {
         for (int i = 0; i < str.length(); ++i) {
             appendEsc(sb, str.charAt(i));
         }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1232
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iceb265553bd20f4ab964a769892169f2c62e44a4
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <tillw@apache.org>

Mime
View raw message