This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new f144d19 [IOTDB-2836] Fix ErrorHandlingUtils exception stacktrace
logging (#5399)
f144d19 is described below
commit f144d19c57c4a5092865377d434f02b076828c89
Author: BaiJian <[email protected]>
AuthorDate: Fri Apr 1 19:41:48 2022 +0800
[IOTDB-2836] Fix ErrorHandlingUtils exception stacktrace logging (#5399)
---
.../org/apache/iotdb/db/utils/ErrorHandlingUtils.java | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
b/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
index 9ca4586..492393b 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
@@ -56,9 +56,9 @@ public class ErrorHandlingUtils {
Exception e, String operation, TSStatusCode statusCode) {
String message = String.format("[%s] Exception occurred: %s failed. ",
statusCode, operation);
if (e instanceof IOException || e instanceof NullPointerException) {
- LOGGER.error("Status code: {}, operation: {} failed", statusCode,
operation, e);
+ LOGGER.error("Status code: " + statusCode + ", operation: " + operation
+ " failed", e);
} else {
- LOGGER.warn("Status code: {}, operation: {} failed", statusCode,
operation, e);
+ LOGGER.warn("Status code: " + statusCode + ", operation: " + operation +
" failed", e);
}
return RpcUtils.getStatus(statusCode, message + e.getMessage());
}
@@ -80,7 +80,8 @@ public class ErrorHandlingUtils {
if (status != null) {
// ignore logging sg not ready exception
if (status.getCode() !=
TSStatusCode.STORAGE_GROUP_NOT_READY.getStatusCode()) {
- LOGGER.error("Status code: {}, Query Statement: {} failed",
status.getCode(), operation, e);
+ LOGGER.error(
+ "Status code: " + status.getCode() + ", Query Statement: " +
operation + " failed", e);
}
return status;
} else {
@@ -149,11 +150,7 @@ public class ErrorHandlingUtils {
Throwable rootCause = getRootCause(e);
// ignore logging sg not ready exception
if (!(rootCause instanceof StorageGroupNotReadyException)) {
- if (((IoTDBException) e).isUserException()) {
- LOGGER.warn(message + e.getMessage());
- } else {
- LOGGER.warn(message, e);
- }
+ LOGGER.warn(message, e);
}
return RpcUtils.getStatus(((IoTDBException) e).getErrorCode(),
rootCause.getMessage());
}
@@ -165,7 +162,7 @@ public class ErrorHandlingUtils {
String message =
String.format(
"[%s] Exception occurred: %s failed. %s", statusCode, operation,
e.getMessage());
- LOGGER.warn("Status code: {}, operation: {} failed", statusCode,
operation, e);
+ LOGGER.warn("Status code: " + statusCode + ", operation: " + operation + "
failed", e);
return RpcUtils.getStatus(errorCode, message);
}