hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasan...@apache.org
Subject hive git commit: HIVE-12402: Split hive.root.logger separately to make it compatible with log4j1.x (Prasanth Jayachandran reviewed by Sergey Shelukhin)
Date Mon, 16 Nov 2015 07:22:40 GMT
Repository: hive
Updated Branches:
  refs/heads/master f549d4154 -> 3d8df7444


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/3d8df744
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/3d8df744
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/3d8df744

Branch: refs/heads/master
Commit: 3d8df7444590c73144a641a6034b533041f0ffdf
Parents: f549d41
Author: Prasanth Jayachandran <j.prasanth.j@gmail.com>
Authored: Fri Nov 13 18:41:33 2015 -0600
Committer: Prasanth Jayachandran <j.prasanth.j@gmail.com>
Committed: Mon Nov 16 01:22:25 2015 -0600

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


http://git-wip-us.apache.org/repos/asf/hive/blob/3d8df744/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");


Mime
View raw message