diff options
author | Vitaly Takmazov | 2016-07-11 12:25:03 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-07-11 12:25:03 +0300 |
commit | d6fb4288688294d2f76325f14410db3091fea0fa (patch) | |
tree | d2070a67794644c2602eaf5bcc41e10438c62f89 /juick-www/src/main/java/com/juick/www/NewMessage.java | |
parent | 3d0ec22f5262058a08e7f551eb5ac02e3636008a (diff) |
logging
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/NewMessage.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/NewMessage.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/juick-www/src/main/java/com/juick/www/NewMessage.java b/juick-www/src/main/java/com/juick/www/NewMessage.java index dc1b25f7..397badbb 100644 --- a/juick-www/src/main/java/com/juick/www/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/NewMessage.java @@ -38,6 +38,8 @@ import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -45,6 +47,8 @@ import java.util.List; */ public class NewMessage { + private static final Logger logger = Logger.getLogger(NewMessage.class.getName()); + protected void doGetNewMessage(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { @@ -159,7 +163,7 @@ public class NewMessage { try { attachmentFName = Utils.receiveMultiPartFile(request, "attach"); } catch (Exception e) { - System.out.println("MULTIPART ERROR: " + e.toString()); + logger.log(Level.SEVERE, "MULTIPART ERROR", e); response.sendError(400); return; } @@ -170,7 +174,7 @@ public class NewMessage { URL imgUrl = new URL(paramImg); attachmentFName = Utils.downloadImage(imgUrl); } catch (Exception e) { - System.out.println("DOWNLOAD ERROR: " + e.toString()); + logger.log(Level.SEVERE, "DOWNLOAD ERROR", e); response.sendError(500); return; } @@ -314,7 +318,7 @@ public class NewMessage { try { attachmentFName = Utils.receiveMultiPartFile(request, "attach"); } catch (Exception e) { - System.out.println("MULTIPART ERROR: " + e.toString()); + logger.log(Level.SEVERE, "MULTIPART ERROR", e); response.sendError(400); return; } @@ -324,7 +328,7 @@ public class NewMessage { try { attachmentFName = Utils.downloadImage(new URL(paramImg)); } catch (Exception e) { - System.out.println("DOWNLOAD ERROR: " + e.toString()); + logger.log(Level.SEVERE, "DOWNLOAD ERROR", e); response.sendError(500); return; } |