You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by hu...@apache.org on 2022/02/03 21:35:10 UTC

[helix] branch master updated: Let logging framework format exception stack traces (#1954)

This is an automated email from the ASF dual-hosted git repository.

hulee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e6dd3e  Let logging framework format exception stack traces (#1954)
3e6dd3e is described below

commit 3e6dd3ecbfdaf97d245c7317b7e25c9ff8bc83d3
Author: Henri Hagberg <he...@relexsolutions.com>
AuthorDate: Thu Feb 3 23:35:05 2022 +0200

    Let logging framework format exception stack traces (#1954)
    
    Where possible, logging calls are changed so that logging framework handles exception formatting instead of stack trace being manually formatted using Throwable#getStackTrace
---
 .../java/org/apache/helix/controller/GenericHelixController.java   | 4 ++--
 .../integration/rebalancer/TestAutoRebalancePartitionLimit.java    | 2 +-
 .../resources/helix/ResourceAssignmentOptimizerAccessor.java       | 7 +++----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
index b7e9fa0..c641b4d 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
@@ -904,8 +904,8 @@ public class GenericHelixController implements IdealStateChangeListener, LiveIns
         pipeline.finish();
       } catch (Exception e) {
         logger.error(
-            "Exception while executing {} pipeline: {} for cluster {}. Will not continue to next pipeline",
-            dataProvider.getPipelineName(), _clusterName, Arrays.toString(e.getStackTrace()));
+            "Exception while executing {} pipeline for cluster {}. Will not continue to next pipeline",
+            dataProvider.getPipelineName(), _clusterName, e);
         if (e instanceof HelixMetaDataAccessException) {
           helixMetaDataAccessRebalanceFail = true;
           // If pipeline failed due to read/write fails to zookeeper, retry the pipeline.
diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalancePartitionLimit.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalancePartitionLimit.java
index 2266fb6..0fb203e 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalancePartitionLimit.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalancePartitionLimit.java
@@ -225,7 +225,7 @@ public class TestAutoRebalancePartitionLimit extends ZkStandAloneCMTestBase {
             numberOfPartitions, masterValue, replicas, cache.getLiveInstances().size(),
             cache.getIdealState(_resourceName).getMaxPartitionsPerInstance());
       } catch (Exception e) {
-        LOG.debug("Verify failed due to {}", e.getStackTrace());
+        LOG.debug("Verify failed", e);
         return false;
       }
     }
diff --git a/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ResourceAssignmentOptimizerAccessor.java b/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ResourceAssignmentOptimizerAccessor.java
index e4c0dad..0ecae71 100644
--- a/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ResourceAssignmentOptimizerAccessor.java
+++ b/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ResourceAssignmentOptimizerAccessor.java
@@ -147,12 +147,11 @@ public class ResourceAssignmentOptimizerAccessor extends AbstractHelixResource {
     } catch (JsonProcessingException e) {
       return badRequest("Invalid input: Input can not be parsed into a KV map." + e.getMessage());
     } catch (OutOfMemoryError e) {
-      LOG.error("OutOfMemoryError while calling partitionAssignment" + Arrays
-          .toString(e.getStackTrace()));
+      LOG.error("OutOfMemoryError while calling partitionAssignment", e);
       return badRequest(
           "Response size is too large to serialize. Please query by resources or instance filter");
     } catch (Exception e) {
-      LOG.error("Failed to compute partition assignment:" + Arrays.toString(e.getStackTrace()));
+      LOG.error("Failed to compute partition assignment", e);
       return badRequest("Failed to compute partition assignment: " + e);
     }
   }
@@ -392,4 +391,4 @@ public class ResourceAssignmentOptimizerAccessor extends AbstractHelixResource {
     headers.put(RESPONSE_HEADER_FIELDS[2], inputFields.returnFormat.name());
     return headers;
   }
-}
\ No newline at end of file
+}