Skip to content

Commit

Permalink
log improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
hjchanna committed Dec 24, 2020
1 parent 8e55b73 commit 70f9ed9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/java/me/channa/jmstool/JmsTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static void main(String[] args) {
if (command == null) {
LOGGER.error("Invalid arguments, please send correct arguments");
helpCommand.execute(jCommander);
return;
}

switch (command) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/channa/jmstool/commands/ConsumeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ public void execute(JCommander jCommander) {
while (messagePropertyNames.hasMoreElements()) {
String propertyName = messagePropertyNames.nextElement().toString();
stringBuilder
.append("[JMS-PROPERTY] ")
.append(propertyName)
.append(":")
.append(message.getStringProperty(propertyName))
.append("\n");
}

stringBuilder.append("message")
.append(":")
stringBuilder.append("[JMS-MESSAGE]: ")
.append(((TextMessage) message).getText());

LOGGER.info(stringBuilder.toString());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/channa/jmstool/commands/PublishCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public void execute(JCommander jCommander) {

// Iterate over the number of message count to receive
for (int i = 0; i < count; i++) {
TextMessage jmsMessage = queueSession.createTextMessage(String.format(message, i));
TextMessage jmsMessage = queueSession.createTextMessage(String.format(message, i + 1));
producer.send(jmsMessage);

LOGGER.info(String.format("Message publish with text: %s", String.format(message, i)));
LOGGER.info(String.format("Message publish with text: %s", String.format(message, i + 1)));
}

} catch (NamingException | JMSException exception) {
Expand Down

0 comments on commit 70f9ed9

Please sign in to comment.