You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pr...@apache.org on 2016/04/05 20:20:53 UTC
hive git commit: HIVE-13036: Split hive.root.logger separately to
make it compatible with log4j1.x (for remaining services) (Prasanth
Jayachandran reviewed by Sergey Shelukhin)
Repository: hive
Updated Branches:
refs/heads/branch-2.0 6b48610a3 -> 59491dfa2
HIVE-13036: Split hive.root.logger separately to make it compatible with log4j1.x (for remaining services) (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/59491dfa
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/59491dfa
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/59491dfa
Branch: refs/heads/branch-2.0
Commit: 59491dfa2d630b6ed1a01a6e121fc7379b733461
Parents: 6b48610
Author: Prasanth Jayachandran <j....@gmail.com>
Authored: Fri Feb 12 12:31:27 2016 -0600
Committer: Prasanth Jayachandran <pr...@apache.org>
Committed: Tue Apr 5 13:20:39 2016 -0500
----------------------------------------------------------------------
.../hadoop/hive/cli/OptionsProcessor.java | 16 ++------------
.../hive/common/cli/CommonCliOptions.java | 23 +++++++++++++++++++-
.../apache/hive/service/server/HiveServer2.java | 7 +++++-
3 files changed, 30 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/59491dfa/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 b6a76d2..b6ab345 100644
--- a/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java
+++ b/cli/src/java/org/apache/hadoop/hive/cli/OptionsProcessor.java
@@ -29,7 +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.apache.hadoop.hive.common.cli.CommonCliOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -122,19 +122,7 @@ public class OptionsProcessor {
// 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));
- }
+ CommonCliOptions.splitAndSetLogger(propKey, confProps);
} else {
System.setProperty(propKey, confProps.getProperty(propKey));
}
http://git-wip-us.apache.org/repos/asf/hive/blob/59491dfa/common/src/java/org/apache/hadoop/hive/common/cli/CommonCliOptions.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/common/cli/CommonCliOptions.java b/common/src/java/org/apache/hadoop/hive/common/cli/CommonCliOptions.java
index e229580..5a991ec 100644
--- a/common/src/java/org/apache/hadoop/hive/common/cli/CommonCliOptions.java
+++ b/common/src/java/org/apache/hadoop/hive/common/cli/CommonCliOptions.java
@@ -26,6 +26,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;
/**
* Reusable code for Hive Cli's.
@@ -94,11 +95,31 @@ public class CommonCliOptions {
System.err.println(
"hiveconf: " + propKey + "=" + confProps.getProperty(propKey));
}
- System.setProperty(propKey, confProps.getProperty(propKey));
+ if (propKey.equalsIgnoreCase("hive.root.logger")) {
+ splitAndSetLogger(propKey, confProps);
+ } else {
+ System.setProperty(propKey, confProps.getProperty(propKey));
+ }
}
return confProps;
}
+ public static void splitAndSetLogger(final String propKey, final Properties confProps) {
+ 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));
+ }
+ }
+
/**
* Print usage information for the CLI.
*/
http://git-wip-us.apache.org/repos/asf/hive/blob/59491dfa/service/src/java/org/apache/hive/service/server/HiveServer2.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/server/HiveServer2.java b/service/src/java/org/apache/hive/service/server/HiveServer2.java
index 98ca117..414db3e 100644
--- a/service/src/java/org/apache/hive/service/server/HiveServer2.java
+++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java
@@ -46,6 +46,7 @@ import org.apache.hadoop.hive.common.JvmPauseMonitor;
import org.apache.hadoop.hive.common.LogUtils;
import org.apache.hadoop.hive.common.LogUtils.LogInitializationException;
import org.apache.hadoop.hive.common.ServerUtils;
+import org.apache.hadoop.hive.common.cli.CommonCliOptions;
import org.apache.hadoop.hive.common.metrics.common.MetricsFactory;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
@@ -686,7 +687,11 @@ public class HiveServer2 extends CompositeService {
for (String propKey : confProps.stringPropertyNames()) {
// save logging message for log4j output latter after log4j initialize properly
debugMessage.append("Setting " + propKey + "=" + confProps.getProperty(propKey) + ";\n");
- System.setProperty(propKey, confProps.getProperty(propKey));
+ if (propKey.equalsIgnoreCase("hive.root.logger")) {
+ CommonCliOptions.splitAndSetLogger(propKey, confProps);
+ } else {
+ System.setProperty(propKey, confProps.getProperty(propKey));
+ }
}
// Process --help