aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-11 12:25:03 +0300
committerGravatar Vitaly Takmazov2016-07-11 12:25:03 +0300
commitd6fb4288688294d2f76325f14410db3091fea0fa (patch)
treed2070a67794644c2602eaf5bcc41e10438c62f89 /juick-api/src/main/java
parent3d0ec22f5262058a08e7f551eb5ac02e3636008a (diff)
logging
Diffstat (limited to 'juick-api/src/main/java')
-rw-r--r--juick-api/src/main/java/com/juick/api/Main.java8
-rw-r--r--juick-api/src/main/java/com/juick/api/Messages.java6
2 files changed, 9 insertions, 5 deletions
diff --git a/juick-api/src/main/java/com/juick/api/Main.java b/juick-api/src/main/java/com/juick/api/Main.java
index afd7c11c..03c97435 100644
--- a/juick-api/src/main/java/com/juick/api/Main.java
+++ b/juick-api/src/main/java/com/juick/api/Main.java
@@ -253,7 +253,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
try {
attachmentFName = Utils.receiveMultiPartFile(request, "attach");
} catch (Exception e) {
- System.out.println("MULTIPART ERROR: " + e.toString());
+ log("MULTIPART ERROR", e);
response.sendError(400);
return;
}
@@ -264,7 +264,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
URL imgUrl = new URL(paramImg);
attachmentFName = Utils.downloadImage(imgUrl);
} catch (Exception e) {
- System.out.println("DOWNLOAD ERROR: " + e.toString());
+ log("DOWNLOAD ERROR", e);
response.sendError(500);
return;
}
@@ -369,7 +369,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
try {
attachmentFName = Utils.receiveMultiPartFile(request, "attach");
} catch (Exception e) {
- System.out.println("MULTIPART ERROR: " + e.toString());
+ log("MULTIPART ERROR", e);
response.sendError(400);
return;
}
@@ -379,7 +379,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
try {
attachmentFName = Utils.downloadImage(new URL(paramImg));
} catch (Exception e) {
- System.out.println("DOWNLOAD ERROR: " + e.toString());
+ log("DOWNLOAD ERROR", e);
response.sendError(500);
return;
}
diff --git a/juick-api/src/main/java/com/juick/api/Messages.java b/juick-api/src/main/java/com/juick/api/Messages.java
index b7131c31..ad8d82e0 100644
--- a/juick-api/src/main/java/com/juick/api/Messages.java
+++ b/juick-api/src/main/java/com/juick/api/Messages.java
@@ -18,6 +18,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
*
@@ -25,6 +27,8 @@ import java.util.List;
*/
public class Messages {
+ private static final Logger logger = Logger.getLogger(Messages.class.getName());
+
JdbcTemplate sql;
MessageSerializer messageSerializer = new MessageSerializer();
@@ -178,7 +182,7 @@ public class Messages {
throw new Exception("Message not found");
}
} catch (Exception e) {
- System.err.println("SETPOPULAR ERROR: " + e.toString());
+ logger.log(Level.SEVERE, "SETPOPULAR ERROR", e);
}
}