You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by om...@apache.org on 2015/11/17 21:19:50 UTC

[39/43] hive git commit: HIVE-12402: Split hive.root.logger separately to make it compatible with log4j1.x (Prasanth Jayachandran reviewed by Sergey Shelukhin)

HIVE-12402: Split hive.root.logger separately to make it compatible with log4j1.x (Prasanth Jayachandran reviewed by Sergey Shelukhin)


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

Branch: refs/heads/master-fixed
Commit: a3c02d0d6b155a3cc308ed7e60aa3cfdc22b4ea3
Parents: f28ed81
Author: Prasanth Jayachandran <j....@gmail.com>
Authored: Fri Nov 13 18:41:33 2015 -0600
Committer: Owen O'Malley <om...@apache.org>
Committed: Tue Nov 17 12:18:35 2015 -0800

----------------------------------------------------------------------
 .../hadoop/hive/cli/OptionsProcessor.java       | 22 +++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/a3c02d0d/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java
----------------------------------------------------------------------
diff --git a/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java b/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java
index 3dee11a..b6a76d2 100644
--- a/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java
+++ b/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java
@@ -29,6 +29,7 @@ import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
+import org.apache.logging.log4j.Level;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -117,7 +118,26 @@ public class OptionsProcessor {
       commandLine = new GnuParser().parse(options, argv);
       Properties confProps = commandLine.getOptionProperties("hiveconf");
       for (String propKey : confProps.stringPropertyNames()) {
-        System.setProperty(propKey, confProps.getProperty(propKey));
+        // with HIVE-11304, hive.root.logger cannot have both logger name and log level.
+        // if we still see it, split logger and level separately for hive.root.logger
+        // and hive.log.level respectively
+        if (propKey.equalsIgnoreCase("hive.root.logger")) {
+          String propVal = confProps.getProperty(propKey);
+          if (propVal.contains(",")) {
+            String[] tokens = propVal.split(",");
+            for (String token : tokens) {
+              if (Level.getLevel(token) == null) {
+                System.setProperty("hive.root.logger", token);
+              } else {
+                System.setProperty("hive.log.level", token);
+              }
+            }
+          } else {
+            System.setProperty(propKey, confProps.getProperty(propKey));
+          }
+        } else {
+          System.setProperty(propKey, confProps.getProperty(propKey));
+        }
       }
 
       Properties hiveVars = commandLine.getOptionProperties("define");