From 2e70097cb74a366ffa58f184e42aac8b32c13c31 Mon Sep 17 00:00:00 2001 From: Paul Rogers Date: Mon, 21 Nov 2016 10:19:15 -0800 Subject: [PATCH] DRILL-5056: UserException does not write full message to log A case occurred in which the External Sort failed during spilling. All that was written to the log was: 2016-11-18 ... INFO o.a.d.e.p.i.xsort.ExternalSortBatch - User Error Occurred Modified the logging code to provide more information to aid tracking down problems that occur in the field. --- .../apache/drill/common/exceptions/UserException.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/org/apache/drill/common/exceptions/UserException.java b/common/src/main/java/org/apache/drill/common/exceptions/UserException.java index 35e71d19a12..87b3fd4e109 100644 --- a/common/src/main/java/org/apache/drill/common/exceptions/UserException.java +++ b/common/src/main/java/org/apache/drill/common/exceptions/UserException.java @@ -38,6 +38,7 @@ * @see org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType */ public class UserException extends DrillRuntimeException { + private static final long serialVersionUID = -6720929331624621840L; private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(UserException.class); public static final String MEMORY_ERROR_MSG = "One or more nodes ran out of memory while executing the query."; @@ -549,7 +550,15 @@ public UserException build(final Logger logger) { if (isSystemError) { logger.error(newException.getMessage(), newException); } else { - logger.info("User Error Occurred", newException); + StringBuilder buf = new StringBuilder(); + buf.append("User Error Occurred"); + if (message != null) { + buf.append(": ").append(message); + } + if (cause != null) { + buf.append(" (").append(cause.getMessage()).append(")"); + } + logger.info(buf.toString(), newException); } return newException;