From 916c25d5845f534ec2648fe17d978cd48a8bd284 Mon Sep 17 00:00:00 2001 From: Andrew Stahlman Date: Thu, 9 Apr 2020 07:57:56 -0700 Subject: [PATCH] Log Exception object directly (#669) Instead of logging the Exception type and stack-trace separately, use `Logger.error(String msg, Throwable t)` to log the message and stack-trace in a single ERROR entry. --- app/com/linkedin/drelephant/ElephantRunner.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/com/linkedin/drelephant/ElephantRunner.java b/app/com/linkedin/drelephant/ElephantRunner.java index ea2162bac..55e6a8fe2 100644 --- a/app/com/linkedin/drelephant/ElephantRunner.java +++ b/app/com/linkedin/drelephant/ElephantRunner.java @@ -423,8 +423,7 @@ public void run() { logger.warn("Timed out while fetching data. Exception message is: " + e.getMessage()); jobFate(finishTimeInfo, appType, applicableFinishTime, jobFinishTime); } catch (Exception e) { - logger.error(e.getMessage()); - logger.error(ExceptionUtils.getStackTrace(e)); + logger.error(String.format("Failed to analyze %s", analysisName), e); jobFate(finishTimeInfo, appType, applicableFinishTime, jobFinishTime); } }