Skip to content

Commit

Permalink
kafka: ensure that errors are logged properly
Browse files Browse the repository at this point in the history
Motivation:
Depending on the logger the statement:

log.error("format {}", exception)

will log stacktrace instead of exception message.

Modification:
ensure, that exception is converted to a string.

Result:
better logging

Acked-by: Lea Morschel
Target: master, 9.0, 8.2
Require-book: no
Require-notes: yes
(cherry picked from commit cede2ba)
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
  • Loading branch information
kofemann authored and mksahakyan committed Mar 27, 2023
1 parent 2afdc7f commit 4e8ef37
Showing 1 changed file with 3 additions and 5 deletions.
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2018 - 2022 Deutsches Elektronen-Synchrotron
* Copyright (C) 2018 - 2023 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -36,8 +36,6 @@ public void onSuccess(ProducerRecord<K, V> record, RecordMetadata recordMetadata
public void onError(ProducerRecord<K, V> producerRecord,
@Nullable RecordMetadata recordMetadata, Exception exception) {
LOGGER.error("Producer exception occurred while publishing message : {}, exception : {}",
producerRecord, exception);
producerRecord, exception.toString());
}


}
}

0 comments on commit 4e8ef37

Please sign in to comment.