aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-10 04:50:07 +0700
committerGravatar Vitaly Takmazov2016-11-10 21:41:14 +0300
commit09221ab5695e99b2df1130ea923c39625ec85429 (patch)
tree58c775188d25239a1e32a83f8007e5f1679d49ee /juick-notifications
parent705d4f87c97dfa20eb6daa88b93ff124fa401b92 (diff)
using slf4j + logback for logging
Diffstat (limited to 'juick-notifications')
-rw-r--r--juick-notifications/build.gradle8
-rw-r--r--juick-notifications/src/main/java/com/juick/components/Notifications.java18
2 files changed, 14 insertions, 12 deletions
diff --git a/juick-notifications/build.gradle b/juick-notifications/build.gradle
index f60edc49..b178758c 100644
--- a/juick-notifications/build.gradle
+++ b/juick-notifications/build.gradle
@@ -7,14 +7,16 @@ repositories {
mavenCentral()
}
+def springFrameworkVersion = '4.3.4.RELEASE'
+def jacksonVersion = '2.8.4'
+def slf4jVersion = '1.7.21'
+
dependencies {
compile project(':juick-core')
- compile 'org.slf4j:slf4j-jdk14:1.7.21'
+ compile 'org.slf4j:slf4j-api:${slf4jVersion}'
compile 'com.ganyo:gcm-server:1.1.0'
compile 'com.notnoop.apns:apns:1.0.0.Beta6'
- def springFrameworkVersion = '4.3.4.RELEASE'
compile "org.springframework:spring-webmvc:${springFrameworkVersion}"
- def jacksonVersion = '2.8.4'
compile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${jacksonVersion}"
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
+ "<command arguments=\"?mid=" + jmsg.getMID() + "\" />"
+ "</commands>"
+ "</toast>";
- 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);
}
}