From a25fa69a0bfa49e5e6366690dafedfb1b2017623 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 1 Nov 2024 00:52:44 +0100 Subject: [PATCH] Der Nachrichten-Wert wird in allen Log-Meldungen mit ausgegeben --- src/main/java/de/juplo/kafka/ExampleProducer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 ); } -- 2.20.1