From c210cede5ce143a0c12646d82d657863f0ec96b6 Mon Sep 17 00:00:00 2001
From: Takanobu Asanuma <tasanuma@apache.org>
Date: Fri, 13 Dec 2019 00:48:14 +0900
Subject: [PATCH] HDFS-15044. [Dynamometer] Show the line of audit log when
 parsing it unsuccessfully. (#1749)

---
 .../workloadgenerator/audit/AuditLogDirectParser.java     | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-workload/src/main/java/org/apache/hadoop/tools/dynamometer/workloadgenerator/audit/AuditLogDirectParser.java b/hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-workload/src/main/java/org/apache/hadoop/tools/dynamometer/workloadgenerator/audit/AuditLogDirectParser.java
index f632d6a0ef..9a1aa24312 100644
--- a/hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-workload/src/main/java/org/apache/hadoop/tools/dynamometer/workloadgenerator/audit/AuditLogDirectParser.java
+++ b/hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-workload/src/main/java/org/apache/hadoop/tools/dynamometer/workloadgenerator/audit/AuditLogDirectParser.java
@@ -125,8 +125,9 @@ public class AuditLogDirectParser implements AuditCommandParser {
       relativeTimestamp = dateFormat.parse(m.group("timestamp")).getTime()
           - startTimestamp;
     } catch (ParseException p) {
-      throw new IOException("Exception while parsing timestamp from audit log",
-          p);
+      throw new IOException(
+          "Exception while parsing timestamp from audit log line: `"
+          + inputLine + "`", p);
     }
     // Sanitize the = in the rename options field into a : so we can split on =
     String auditMessageSanitized =
@@ -141,7 +142,8 @@ public class AuditLogDirectParser implements AuditCommandParser {
         parameterMap.put(splitMessage[0], splitMessage[1]);
       } catch (ArrayIndexOutOfBoundsException e) {
         throw new IOException(
-            "Exception while parsing a message from audit log", e);
+            "Exception while parsing a message from audit log line: `"
+            + inputLine + "`", e);
       }
     }