diff options
author | rama-huawei <rama.subba.reddy.s@huawei.com> | 2017-09-14 15:58:53 +0530 |
---|---|---|
committer | Rama SubbaReddy <rama.subba.reddy.s@huawei.com> | 2017-09-14 11:38:02 +0000 |
commit | 3d7aca20473c446980d6e590178d1a6fa83668ff (patch) | |
tree | 58cc85910c812b51379d025fe7b9e6d2da3e4636 /src/main | |
parent | af7732a8c2f1b96046a6a2e9b73e606aabb07af7 (diff) |
Fix for Sonar critical issues
DCAEGEN2-93
Change-Id: I31edc7ff781d1d2522bd0ab0df440cc38ee24e3a
Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/att/nsa/mr/logging/MRAppender.java | 10 |
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() { |