You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2021/05/20 21:46:25 UTC

[pulsar] branch master updated: Force printing of system.out.printf message (#10658)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new ba1298c  Force printing of system.out.printf message (#10658)
ba1298c is described below

commit ba1298ccaf488818bbf3a1876a1909b005982ad9
Author: newur <gi...@mailbox.org>
AuthorDate: Thu May 20 23:43:23 2021 +0200

    Force printing of system.out.printf message (#10658)
    
    * Force printing of system.out.printf message
    
    printf writes into a buffer that will not print instantly. Even worse IDE terminals will ignore System.out.flush() calls.
    
    See https://stackoverflow.com/questions/9852705/java-printf-not-printing#comment12559175_9852740
    
    I used IntelliJ (most recent version from 2021) and thought something was broken or unreasonably slow.
    
    * Fix typo
    
    * Use println instead of printf
---
 site2/docs/client-libraries-java.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/site2/docs/client-libraries-java.md b/site2/docs/client-libraries-java.md
index 27ec7e4..da25f16 100644
--- a/site2/docs/client-libraries-java.md
+++ b/site2/docs/client-libraries-java.md
@@ -212,7 +212,7 @@ The following is an example.
 
 ```java
 producer.sendAsync("my-async-message".getBytes()).thenAccept(msgId -> {
-    System.out.printf("Message with ID %s successfully sent", msgId);
+    System.out.println("Message with ID " + msgId + " successfully sent");
 });
 ```
 
@@ -255,7 +255,7 @@ while (true) {
 
   try {
       // Do something with the message
-      System.out.printf("Message received: %s", new String(msg.getData()));
+      System.out.println("Message received: " + new String(msg.getData()));
 
       // Acknowledge the message so that it can be deleted by the message broker
       consumer.acknowledge(msg);