diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java index aa293860a61..a2e124309d1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java @@ -540,14 +540,15 @@ public class AggregatedLogFormat { @Override public void close() { - if (writer != null) { - try { + try { + if (writer != null) { writer.close(); - } catch (IOException e) { - LOG.warn("Exception closing writer", e); } + } catch (Exception e) { + LOG.warn("Exception closing writer", e); + } finally { + IOUtils.closeStream(this.fsDataOStream); } - IOUtils.closeStream(fsDataOStream); } }