aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorvarun gudisena <vg411h@att.com>2017-09-23 00:01:13 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-23 00:01:13 +0000
commitf91dc172779322546964fed62c10d89c45a13544 (patch)
treedb0457036d1fad7c5bbc96ff12c23bb23c9b0db0 /src/main
parent4f8ff86d68b0b0a2cac3f072fa5d02989d276d3e (diff)
parent3d7aca20473c446980d6e590178d1a6fa83668ff (diff)
Merge "Fix for Sonar critical issues"
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/att/nsa/mr/logging/MRAppender.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/com/att/nsa/mr/logging/MRAppender.java b/src/main/java/com/att/nsa/mr/logging/MRAppender.java
index 8faf0df..364f36d 100644
--- a/src/main/java/com/att/nsa/mr/logging/MRAppender.java
+++ b/src/main/java/com/att/nsa/mr/logging/MRAppender.java
@@ -26,8 +26,10 @@ package com.att.nsa.mr.logging;
import java.io.IOException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.spi.LoggingEvent;
import com.att.nsa.mr.client.MRClientFactory;
@@ -39,6 +41,8 @@ import com.att.nsa.mr.client.MRPublisher;
*/
public class MRAppender extends AppenderSkeleton {
+ private Logger logger = LoggerFactory.getLogger(this.getClass().getName());
+
private MRPublisher fPublisher;
//Provided through log4j configuration
@@ -98,7 +102,7 @@ public class MRAppender extends AppenderSkeleton {
try {
fPublisher.send(partition, message);
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("IOException: ", e);
}
}
@@ -106,7 +110,7 @@ public class MRAppender extends AppenderSkeleton {
if (hosts != null && topic != null && partition != null) {
fPublisher = MRClientFactory.createBatchingPublisher(hosts.split(","), topic, maxBatchSize, maxAgeMs, compress);
} else {
- LogLog.error("The Hosts, Topic, and Partition parameter are required to create a MR Log4J Appender");
+ logger.error("The Hosts, Topic, and Partition parameter are required to create a MR Log4J Appender");
}
}
public String getTopic() {