diff options
-rw-r--r-- | src/main/java/com/att/nsa/mr/logging/MRAppender.java | 1 | ||||
-rw-r--r-- | src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java | 17 |
2 files changed, 13 insertions, 5 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 364f36d..4bb3e71 100644 --- a/src/main/java/com/att/nsa/mr/logging/MRAppender.java +++ b/src/main/java/com/att/nsa/mr/logging/MRAppender.java @@ -106,6 +106,7 @@ public class MRAppender extends AppenderSkeleton { } } + @Override public void activateOptions() { if (hosts != null && topic != null && partition != null) { fPublisher = MRClientFactory.createBatchingPublisher(hosts.split(","), topic, maxBatchSize, maxAgeMs, compress); diff --git a/src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java b/src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java index 2294d7b..61aa836 100644 --- a/src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java +++ b/src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java @@ -29,6 +29,9 @@ import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.att.nsa.mr.client.MRBatchingPublisher; import com.att.nsa.mr.client.MRClientFactory; import com.att.nsa.mr.client.MRPublisher.message; @@ -39,16 +42,20 @@ import com.att.nsa.mr.client.MRPublisher.message; */ public class ConsolePublisher { + + private static final Logger logger = LoggerFactory.getLogger(ConsolePublisher.class); + private ConsolePublisher() { + } public static void main ( String[] args ) throws IOException //throws IOException, InterruptedException { // read the hosts(s) from the command line - final String hosts = ( args.length > 0 ? args[0] : "aaa.it.att.com,bbb.it.att.com,ccc.it.att.com" ); + final String hosts = args.length > 0 ? args[0] : "aaa.it.att.com,bbb.it.att.com,ccc.it.att.com"; // read the topic name from the command line - final String topic = ( args.length > 1 ? args[1] : "TEST-TOPIC" ); + final String topic = args.length > 1 ? args[1] : "TEST-TOPIC"; // read the topic name from the command line - final String partition = ( args.length > 2 ? args[2] : UUID.randomUUID ().toString () ); + final String partition = args.length > 2 ? args[2] : UUID.randomUUID ().toString (); // set up some batch limits and the compression flag final int maxBatchSize = 100; @@ -76,11 +83,11 @@ public class ConsolePublisher } catch ( InterruptedException e ) { - System.err.println ( "Send on close interrupted." ); + logger.error( "Send on close interrupted." ); } for ( message m : leftovers ) { - System.err.println ( "Unsent message: " + m.fMsg ); + logger.error( "Unsent message: " + m.fMsg ); } } } |