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;
*/
public class MRAppender extends AppenderSkeleton {
+ private Logger logger = LoggerFactory.getLogger(this.getClass().getName());
+
private MRPublisher fPublisher;
//Provided through log4j configuration
try {
fPublisher.send(partition, message);
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("IOException: ", e);
}
}
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() {