Skip to content

Commit

Permalink
telemetry: Don't log stacktrace for caught expceptions
Browse files Browse the repository at this point in the history
Motivation:

When an exception is thrown, for example the telemetry can't connect to the collector, this is caught with a stacktrace being logged.

Modification:

Replace it with calls of getClass() and getMessage() methods on the exception object.

Result:

Instead of a stacktrace the exception class and its message is logged.

Target: master
Request: 8.2
Request: 8.1
Request: 8.0
Request: 7.2
Closes: #6973
Acked-by: Tigran, Lea
  • Loading branch information
svemeyer committed Feb 3, 2023
1 parent c514d71 commit 7dedcf5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Expand Up @@ -119,8 +119,8 @@ private OptionalLong loadStorage() {

} catch (CacheException | InterruptedException | NoRouteToCellException e) {
LOGGER.error(
"Could not get storage information; set storage to -1.0. This was caused by: ",
e);
"Could not get storage information; set storage to -1.0. This was caused by: {}",
e.toString());
}

return space;
Expand Down
Expand Up @@ -48,8 +48,8 @@ public class SendData implements CellCommandListener, CellLifeCycleAware {
public void setUrlStr(String url) {
try {
uri = URI.create(url);
} catch (IllegalArgumentException iae) {
LOGGER.error("Failed to create URL. Reason: ", iae);
} catch (IllegalArgumentException e) {
LOGGER.error("Failed to create URL. Reason: {}", e.toString());
throw new RuntimeException();
}
}
Expand Down Expand Up @@ -115,8 +115,8 @@ private void sendData() {
} else {
LOGGER.info("Information successfully sent to {}", uri);
}
} catch (InterruptedException | IOException ioe) {
LOGGER.error("Sending data to {} failed, caused by: ", uri, ioe);
} catch (InterruptedException | IOException e) {
LOGGER.error("Sending data to {} failed, caused by: {}", uri, e.toString());
}
}

Expand Down

0 comments on commit 7dedcf5

Please sign in to comment.