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 5e4648a89a5..38c1e6a7084 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 @@ -473,14 +473,15 @@ public class AggregatedLogFormat { @Override public void close() { - if (writer != null) { - try { - this.writer.close(); - } catch (IOException e) { - LOG.warn("Exception closing writer", e); + try { + if (writer != null) { + writer.close(); } + } catch (Exception e) { + LOG.warn("Exception closing writer", e); + } finally { + IOUtils.closeStream(this.fsDataOStream); } - IOUtils.closeStream(fsDataOStream); } }