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
  • Loading branch information
kofemann committed Mar 17, 2023
1 parent 59f5862 commit cede2ba
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 cede2ba

Please sign in to comment.