public void onCompletion(RecordMetadata recordMetadata, Exception e) {
            synchronized (System.out) {
                if (e == null) {
                    VerifiableProducer.this.numAcked++;
                    printJson(new SuccessfulSend(this.key, this.value, recordMetadata));
                } else {
                    printJson(new FailedSend(this.key, this.value, topic, e));
                }
            }
        }
Callback which prints errors to stdout when the producer fails to send.
tools/src/main/java/org/apache/kafka/tools/VerifiableProducer.java