diff src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java @ 75:25eb2e1df106

change logging to java.util.logging.
author casties
date Fri, 21 Mar 2014 13:32:41 +0100
parents 2b1e6df5e21a
children b406507a953d
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java	Wed Mar 12 12:42:28 2014 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java	Fri Mar 21 13:32:41 2014 +0100
@@ -70,7 +70,7 @@
      */
     @Get("json")
     public Representation doGetJSON(Representation entity) {
-        logger.debug("AnnotatorAnnotations doGetJSON!");
+        logger.fine("AnnotatorAnnotations doGetJSON!");
         setCorsHeaders();
         // id from URI /annotations/{id}
         String id = null;
@@ -83,12 +83,12 @@
                 // this shouldn't happen
             }
             id = decodeJsonId(jsonId);
-            logger.debug("annotation-id=" + id);
+            logger.fine("annotation-id=" + id);
         }
 
         // do authentication
         Person authUser = Person.createPersonWithId(this.checkAuthToken(entity));
-        logger.debug("request authenticated=" + authUser);
+        logger.fine("request authenticated=" + authUser);
 
         if (id == null) {
             // no id -- send all annotations
@@ -167,13 +167,13 @@
      */
     @Post("json")
     public Representation doPostJson(Representation entity) {
-        logger.debug("AnnotatorAnnotations doPostJSON!");
+        logger.fine("AnnotatorAnnotations doPostJSON!");
         // set headers
         setCorsHeaders();
 
         // do authentication TODO: who's allowed to create?
         Person authUser = Person.createPersonWithId(this.checkAuthToken(entity));
-        logger.debug("request authenticated=" + authUser);
+        logger.fine("request authenticated=" + authUser);
         if (authUser == null) {
             setStatus(Status.CLIENT_ERROR_FORBIDDEN, "Not Authorized!");
             return null;
@@ -222,16 +222,16 @@
      */
     @Put("json")
     public Representation doPutJSON(Representation entity) {
-        logger.debug("AnnotatorAnnotations doPutJSON!");
+        logger.fine("AnnotatorAnnotations doPutJSON!");
         setCorsHeaders();
         // id from URI /annotations/{id}
         String jsonId = (String) getRequest().getAttributes().get("id");
         String id = decodeJsonId(jsonId);
-        logger.debug("annotation-id=" + id);
+        logger.fine("annotation-id=" + id);
 
         // do authentication
         Person authUser = Person.createPersonWithId(this.checkAuthToken(entity));
-        logger.debug("request authenticated=" + authUser);
+        logger.fine("request authenticated=" + authUser);
 
         Annotation annot = null;
         AnnotationStore store = getAnnotationStore();
@@ -268,10 +268,10 @@
             JsonRepresentation retRep = new JsonRepresentation(jo);
             return retRep;
         } catch (JSONException e) {
-            logger.error("Error in doPutJSON", e);
+            logger.severe("Error in doPutJSON: "+e);
             setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
         } catch (IOException e) {
-            logger.error("Error in doPutJSON", e);
+            logger.severe("Error in doPutJSON: "+e);
             setStatus(Status.SERVER_ERROR_INTERNAL, "Other Error");
         }
         return null;
@@ -285,16 +285,16 @@
      */
     @Delete("json")
     public Representation doDeleteJSON(Representation entity) {
-        logger.debug("AnnotatorAnnotations doDeleteJSON!");
+        logger.fine("AnnotatorAnnotations doDeleteJSON!");
         setCorsHeaders();
         // id from URI /annotations/{id}
         String jsonId = (String) getRequest().getAttributes().get("id");
         String id = decodeJsonId(jsonId);
-        logger.debug("annotation-id=" + id);
+        logger.fine("annotation-id=" + id);
 
         // do authentication
         Person authUser = Person.createPersonWithId(this.checkAuthToken(entity));
-        logger.debug("request authenticated=" + authUser);
+        logger.fine("request authenticated=" + authUser);
         AnnotationStore store = getAnnotationStore();
         Annotation annot = store.getAnnotationById(id);
         if (annot != null) {