aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-02-01 23:20:23 +0300
committerGravatar Vitaly Takmazov2016-02-01 23:20:23 +0300
commit26c09174eb64d6f67509236a8f47992b475b7c6b (patch)
tree72962478746f614f1417d02e40b683b4f076fd3d /src/main/java/com/juick
parentc8d875bfcf1b040881e9c18282905a1ff805eb0c (diff)
fb logging
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/http/www/FacebookLogin.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/juick/http/www/FacebookLogin.java b/src/main/java/com/juick/http/www/FacebookLogin.java
index 9658c0d6..fcb08d6c 100644
--- a/src/main/java/com/juick/http/www/FacebookLogin.java
+++ b/src/main/java/com/juick/http/www/FacebookLogin.java
@@ -25,6 +25,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@@ -37,6 +39,8 @@ import org.json.JSONObject;
*/
public class FacebookLogin {
+ private static final Logger logger = Logger.getLogger(FacebookLogin.class.getName());
+
private static final String FACEBOOK_APPID = "130568668304";
private static final String FACEBOOK_SECRET = "95813bfb6ab8f473410c50d4f971649e";
private static final String FACEBOOK_REDIRECT = "http://juick.com/_fblogin";
@@ -68,7 +72,7 @@ public class FacebookLogin {
String token = Utils.fetchURL("https://graph.facebook.com/oauth/access_token?client_id=" + FACEBOOK_APPID + "&redirect_uri=" + URLEncoder.encode(FACEBOOK_REDIRECT, "utf-8") + "&client_secret=" + FACEBOOK_SECRET + "&code=" + URLEncoder.encode(code, "utf-8"));
if (token == null || token.isEmpty() || !token.startsWith("access_token=")) {
- System.err.println("FACEBOOK TOKEN ERROR: " + token);
+ logger.log(Level.SEVERE, "FACEBOOK TOKEN ERROR: " + token);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
@@ -122,6 +126,7 @@ public class FacebookLogin {
throw new Exception();
}
} catch (Exception e) {
+ logger.log(Level.WARNING, "fb error", e);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}