From 603418c1738a507d0d90ec3f48791575effb3d51 Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Tue, 17 Jul 2012 19:14:33 +0000 Subject: [PATCH] MAPREDUCE-4380. Empty Userlogs directory is getting created under logs directory (Devaraj K via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1362612 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/mapred/TaskLog.java | 14 ++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index fdb96de34a..eb487b13d0 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -254,6 +254,9 @@ Release 2.1.0-alpha - Unreleased MAPREDUCE-4395. Possible NPE at ClientDistributedCacheManager #determineTimestamps (Bhallamudi via bobby) + MAPREDUCE-4380. Empty Userlogs directory is getting created under logs + directory (Devaraj K via bobby) + Release 2.0.0-alpha - 05-23-2012 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java index 4d47df9b8d..12ad047999 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java @@ -66,14 +66,6 @@ public class TaskLog { // localFS is set in (and used by) writeToIndexFile() static LocalFileSystem localFS = null; - static { - if (!LOG_DIR.exists()) { - boolean b = LOG_DIR.mkdirs(); - if (!b) { - LOG.debug("mkdirs failed. Ignoring."); - } - } - } public static String getMRv2LogDir() { return System.getProperty(MRJobConfig.TASK_LOG_DIR); @@ -638,6 +630,12 @@ public static List captureDebugOut(List cmd, * @return base log directory */ static File getUserLogDir() { + if (!LOG_DIR.exists()) { + boolean b = LOG_DIR.mkdirs(); + if (!b) { + LOG.debug("mkdirs failed. Ignoring."); + } + } return LOG_DIR; }