From 09221ab5695e99b2df1130ea923c39625ec85429 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Thu, 10 Nov 2016 04:50:07 +0700 Subject: using slf4j + logback for logging --- .../main/java/com/juick/components/Notifications.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'juick-notifications/src') diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java index 7bb81530..12993418 100644 --- a/juick-notifications/src/main/java/com/juick/components/Notifications.java +++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java @@ -41,6 +41,8 @@ import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.http.util.TextUtils; import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.env.Environment; @@ -55,8 +57,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutorService; -import java.util.logging.Level; -import java.util.logging.Logger; /** * @@ -64,7 +64,7 @@ import java.util.logging.Logger; */ public class Notifications implements DisposableBean, Stream.StreamListener, MessageListener { - private static Logger logger = Logger.getLogger(Notifications.class.getName()); + private static Logger logger = LoggerFactory.getLogger(Notifications.class); String wns_application_sip; String wns_client_secret; @@ -101,7 +101,7 @@ public class Notifications implements DisposableBean, Stream.StreamListener, Mes xmpp.addListener((Stream.StreamListener) this); xmpp.addListener((MessageListener) this); } catch (IOException e) { - logger.log(Level.SEVERE, e.getMessage(), e); + logger.error(e.getMessage(), e); } } @@ -111,7 +111,7 @@ public class Notifications implements DisposableBean, Stream.StreamListener, Mes } @Override - public void onStreamFail(Exception e) {logger.log(Level.SEVERE, "XMPP STREAM FAIL", e);} + public void onStreamFail(Exception e) {logger.error("XMPP STREAM FAIL", e);} @Override public void onMessage(com.juick.xmpp.Message msg) { @@ -144,9 +144,9 @@ public class Notifications implements DisposableBean, Stream.StreamListener, Mes logger.info("RES " + i + ": " + results.get(i).toString()); } } catch (IOException e) { - logger.log(Level.SEVERE, e.getMessage(), e); + logger.error(e.getMessage(), e); } catch (IllegalArgumentException err) { - logger.warning("Android: Invalid API Key"); + logger.warn("Android: Invalid API Key"); } } else { logger.info("GMS: no recipients"); @@ -188,13 +188,13 @@ public class Notifications implements DisposableBean, Stream.StreamListener, Mes + "" + "" + ""; - logger.fine(xml); + logger.trace(xml); for (String url : urls) { logger.info("WNS: " + url); sendWNS(wnsToken, url, xml); } } catch (IOException | IllegalStateException e) { - logger.log(Level.SEVERE, "WNS: ", e); + logger.error("WNS: ", e); } } -- cgit v1.2.3