From 9cab42cc797986081fef184748044f1790a4f039 Mon Sep 17 00:00:00 2001 From: Brahma Reddy Battula Date: Tue, 23 May 2017 02:39:19 +0800 Subject: [PATCH] HDFS-11849. JournalNode startup failure exception should be logged in log file. Contributed By Surendra Singh Lilhore. --- .../apache/hadoop/hdfs/qjournal/server/JournalNode.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java index ab724d5266b..6056e34d8f3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java @@ -17,6 +17,8 @@ */ package org.apache.hadoop.hdfs.qjournal.server; +import static org.apache.hadoop.util.ExitUtil.terminate; + import java.io.File; import java.io.FileFilter; import java.io.IOException; @@ -330,7 +332,12 @@ public class JournalNode implements Tool, Configurable, JournalNodeMXBean { public static void main(String[] args) throws Exception { StringUtils.startupShutdownMessage(JournalNode.class, args, LOG); - System.exit(ToolRunner.run(new JournalNode(), args)); + try { + System.exit(ToolRunner.run(new JournalNode(), args)); + } catch (Throwable e) { + LOG.error("Failed to start journalnode.", e); + terminate(-1, e); + } } public void doPreUpgrade(String journalId) throws IOException {