From: Kai Moritz Date: Thu, 31 Oct 2024 23:52:44 +0000 (+0100) Subject: Der Nachrichten-Wert wird in allen Log-Meldungen mit ausgegeben X-Git-Tag: grundlagen/simple-producer--2024-11-13--si~1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=a25fa69a0bfa49e5e6366690dafedfb1b2017623;p=demos%2Fkafka%2Ftraining Der Nachrichten-Wert wird in allen Log-Meldungen mit ausgegeben --- diff --git a/src/main/java/de/juplo/kafka/ExampleProducer.java b/src/main/java/de/juplo/kafka/ExampleProducer.java index a105d36..b942a58 100644 --- a/src/main/java/de/juplo/kafka/ExampleProducer.java +++ b/src/main/java/de/juplo/kafka/ExampleProducer.java @@ -79,7 +79,7 @@ public class ExampleProducer // HANDLE SUCCESS produced++; log.debug( - "{} - Sent key={} message={} partition={}/{} timestamp={} latency={}ms", + "{} - Sent message {}={}, partition={}:{}, timestamp={}, latency={}ms", id, record.key(), record.value(), @@ -93,9 +93,10 @@ public class ExampleProducer { // HANDLE ERROR log.error( - "{} - ERROR key={} timestamp={} latency={}ms: {}", + "{} - ERROR for message {}={}, timestamp={}, latency={}ms: {}", id, record.key(), + record.value(), metadata == null ? -1 : metadata.timestamp(), now - time, e.toString() @@ -105,9 +106,10 @@ public class ExampleProducer long now = System.currentTimeMillis(); log.trace( - "{} - Queued message with key={} latency={}ms", + "{} - Queued message {}={}, latency={}ms", id, record.key(), + record.value(), now - time ); }