From 43d2f79cd9ce34dfa262e01fb4f52fc71f34ffa2 Mon Sep 17 00:00:00 2001 From: Riley Date: Mon, 22 Apr 2024 15:55:20 -0400 Subject: [PATCH] #2898 Reduced sout lines --- .../com/iluwatar/publishsubscribe/Borrower.java | 15 ++++++++------- .../com/iluwatar/publishsubscribe/Lender.java | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/publish-subscribe/src/main/java/com/iluwatar/publishsubscribe/Borrower.java b/publish-subscribe/src/main/java/com/iluwatar/publishsubscribe/Borrower.java index 1198fc5eeef3..a206a636af98 100644 --- a/publish-subscribe/src/main/java/com/iluwatar/publishsubscribe/Borrower.java +++ b/publish-subscribe/src/main/java/com/iluwatar/publishsubscribe/Borrower.java @@ -1,6 +1,7 @@ package com.iluwatar.publishsubscribe; import lombok.extern.slf4j.Slf4j; +import org.slf4j.event.Level; import javax.jms.BytesMessage; import javax.jms.JMSException; import javax.jms.Message; @@ -50,7 +51,7 @@ public Borrower(String topicCFName, String topicName, double initialRate) { subscriber.setMessageListener(this); tConnection.start(); - System.out.println("Initial rate is " + currentRate + " \nWaiting for new rates..."); + LOGGER.info("Initial rate is " + currentRate + " \nWaiting for new rates..."); } catch(NamingException e) { LOGGER.error(ERROR, e); } catch(JMSException e) { @@ -72,7 +73,7 @@ public void onMessage(Message message) { } catch(JMSException e) { LOGGER.error(ERROR, e); } - System.out.println("Waiting for new rates..."); + LOGGER.info("Waiting for new rates..."); } public boolean close() { @@ -95,9 +96,9 @@ public static void main(String[] args) { topicName = args[1]; rate = Integer.parseInt(args[2]); } else { - System.out.println("Invalid arguments. Should be: "); - System.out.println("java TBorrower [factory] [topic] [rate]"); - System.exit(0); + LOGGER.info("Invalid arguments. Should be: "); + LOGGER.info("java TBorrower [factory] [topic] [rate]"); + System.exit(1); } Borrower borrower = new Borrower(topicCF, topicName, rate); @@ -106,8 +107,8 @@ public static void main(String[] args) { // Run until enter is pressed BufferedReader reader = new BufferedReader (new InputStreamReader(System.in)); - System.out.println ("TBorrower application started"); - System.out.println ("Press enter to quit application"); + LOGGER.info("TBorrower application started"); + LOGGER.info("Press enter to quit application"); reader.readLine(); borrower.close(); System.exit(0); diff --git a/publish-subscribe/src/main/java/com/iluwatar/publishsubscribe/Lender.java b/publish-subscribe/src/main/java/com/iluwatar/publishsubscribe/Lender.java index dd504e57f49a..73d4200fb115 100644 --- a/publish-subscribe/src/main/java/com/iluwatar/publishsubscribe/Lender.java +++ b/publish-subscribe/src/main/java/com/iluwatar/publishsubscribe/Lender.java @@ -129,7 +129,7 @@ public static void main(String[] args) { String line = reader.readLine(); //Exit if user pressed enter or line is blank if (line == null || line.trim().length() == 0) { - System.out.println("Exiting..."); + LOGGER.info("Exiting..."); lender.close(); System.exit(0); }