You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ha...@apache.org on 2017/03/24 12:59:08 UTC

oozie git commit: OOZIE-2739 Remove property expansion pattern from ShellMain's log4j properties content (harsh)

Repository: oozie
Updated Branches:
  refs/heads/master 3601e5b94 -> 1392eeaf8


OOZIE-2739 Remove property expansion pattern from ShellMain's log4j properties content (harsh)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/1392eeaf
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/1392eeaf
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/1392eeaf

Branch: refs/heads/master
Commit: 1392eeaf8397a6c6814607cf61cb962403df1447
Parents: 3601e5b
Author: Harsh J <ha...@cloudera.com>
Authored: Fri Mar 24 18:03:47 2017 +0530
Committer: Harsh J <ha...@cloudera.com>
Committed: Fri Mar 24 18:03:47 2017 +0530

----------------------------------------------------------------------
 core/src/main/resources/oozie-default.xml         |  3 +--
 .../action/hadoop/TestShellActionExecutor.java    | 18 ++++++++++++++----
 release-log.txt                                   |  1 +
 3 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/1392eeaf/core/src/main/resources/oozie-default.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/oozie-default.xml b/core/src/main/resources/oozie-default.xml
index 03f428a..c2e6ec2 100644
--- a/core/src/main/resources/oozie-default.xml
+++ b/core/src/main/resources/oozie-default.xml
@@ -1882,8 +1882,7 @@ will be the requeue interval for the actions which are waiting for a long time w
     <property>
         <name>oozie.action.shell.setup.hadoop.conf.dir.log4j.content</name>
         <value>
-            log4j.rootLogger=${hadoop.root.logger}
-            hadoop.root.logger=INFO,console
+            log4j.rootLogger=INFO,console
             log4j.appender.console=org.apache.log4j.ConsoleAppender
             log4j.appender.console.target=System.err
             log4j.appender.console.layout=org.apache.log4j.PatternLayout

http://git-wip-us.apache.org/repos/asf/oozie/blob/1392eeaf/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java b/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
index 1531ed9..f12927b 100644
--- a/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
+++ b/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
@@ -69,9 +69,15 @@ public class TestShellActionExecutor extends ActionExecutorTestCase {
             ? "IF EXIST %HADOOP_CONF_DIR%\\log4j.properties echo L4J_EXISTS=yes\n"
             : "if [ -f $HADOOP_CONF_DIR/log4j.properties ]; then echo L4J_EXISTS=yes; fi\n";
     private static final String SHELL_SCRIPT_LOG4J_CONTENT_COUNTER = Shell.WINDOWS
-            ? "SET COMMAND=\"type %HADOOP_CONF_DIR%\\log4j.properties | FIND /c /v \"~DOESNOTMATCH~\"\"\n" +
-              "FOR /f %%i IN (' %COMMAND% ') DO SET L4J_LC=%%i\necho L4J_WC=%L4J_LC%\n"
-            : "echo L4J_LC=$(cat $HADOOP_CONF_DIR/log4j.properties | wc -l)\n";
+            ? "FOR /f %%i IN ('TYPE %HADOOP_CONF_DIR%\\log4j.properties " +
+              "^| FIND /c /v \"~DOESNOTMATCH~\"') DO " +
+              "SET L4J_LC=%%i\necho L4J_LC=%L4J_LC%\n" +
+              "FOR /f %%i IN ('FINDSTR \"CLA CLRA\" %HADOOP_CONF_DIR%\\log4j.properties " +
+              "^| FIND /c /v \"~DOESNOTMATCH~\"') DO " +
+              "SET L4J_APPENDER=%%i\necho L4J_APPENDER=%L4J_APPENDER%\n"
+            : "echo L4J_LC=$(cat $HADOOP_CONF_DIR/log4j.properties | wc -l)\n" +
+              "echo L4J_APPENDER=$(grep -e 'CLA' -e 'CLRA' -c " +
+              "$HADOOP_CONF_DIR/log4j.properties)\n";
 
     /**
      * Verify if the ShellActionExecutor indeed setups the basic stuffs
@@ -162,6 +168,7 @@ public class TestShellActionExecutor extends ActionExecutorTestCase {
         String yarnConfDir = PropertiesUtils.stringToProperties(action.getData()).getProperty("YARN_CONF_DIR");
         String log4jExists = PropertiesUtils.stringToProperties(action.getData()).getProperty("L4J_EXISTS");
         String log4jFileLineCount = PropertiesUtils.stringToProperties(action.getData()).getProperty("L4J_LC");
+        String log4BadAppenderCount = PropertiesUtils.stringToProperties(action.getData()).getProperty("L4J_APPENDER");
         assertNotNull(oozieActionConfXml);
         assertNotNull(hadoopConfDir);
         String s = new File(oozieActionConfXml).getParent() + File.separator + "oozie-hadoop-conf-";
@@ -172,10 +179,13 @@ public class TestShellActionExecutor extends ActionExecutorTestCase {
                 "Expected YARN_CONF_DIR to start with " + s + " but was " + yarnConfDir,
                 yarnConfDir.startsWith(s));
         Assert.assertEquals(
-                "Expected log4j.properties file to exist", log4jExists, "yes");
+                "Expected log4j.properties file to exist", "yes", log4jExists);
         Assert.assertTrue(
                 "Expected log4j.properties to have non-zero line count, but has: " + log4jFileLineCount,
                 Integer.parseInt(log4jFileLineCount) > 0);
+        Assert.assertEquals(
+                "Expected log4j.properties to have no container appender references (CLA/CLRA)",
+                0, Integer.parseInt(log4BadAppenderCount));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/oozie/blob/1392eeaf/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 6df9ed3..f9b926b 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.4.0 release (trunk - unreleased)
 
+OOZIE-2739 Remove property expansion pattern from ShellMain's log4j properties content (harsh)
 OOZIE-2817 amend Increase test case stability in pre-commit job (abhishekbafna)
 OOZIE-2838 TestClassUtils,TestJsonUtils,TestWritableUtils,TestXmlUtils shall not be an Oozie XTestCase (asasvari via pbacsko)
 OOZIE-2811 amend Add support for filtering out properties from SparkConfigurationService