Repository: hive
Updated Branches:
  refs/heads/branch-2 455b2cc5b -> 6dbec04dd


HIVE-18472 : Beeline gives log4j warnings (Janaki Lahorani via Vihang 
Karajgaonkar)


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

Branch: refs/heads/branch-2
Commit: 6dbec04ddc401b78bb5cce3a89b8a44613ccfe70
Parents: 455b2cc
Author: Vihang Karajgaonkar <[email protected]>
Authored: Mon Jan 29 11:23:07 2018 -0800
Committer: Vihang Karajgaonkar <[email protected]>
Committed: Mon Jan 29 11:23:07 2018 -0800

----------------------------------------------------------------------
 bin/hive | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/6dbec04d/bin/hive
----------------------------------------------------------------------
diff --git a/bin/hive b/bin/hive
index a7671c3..26de11e 100755
--- a/bin/hive
+++ b/bin/hive
@@ -133,8 +133,17 @@ if [ ! -f ${HIVE_LIB}/hive-cli-*.jar ]; then
   exit 3;
 fi
 
+# Hbase and Hadoop use their own log4j jars.  Including hives log4j jars can 
cause
+# log4j warnings.  So save hives log4j jars in LOG_JAR_CLASSPATH, and add it 
to classpath
+# after Hbase and Hadoop calls finish
+LOG_JAR_CLASSPATH="";
+
 for f in ${HIVE_LIB}/*.jar; do
-  CLASSPATH=${CLASSPATH}:$f;
+  if [[ $f == *"log4j"* ]]; then
+    LOG_JAR_CLASSPATH=${LOG_JAR_CLASSPATH}:$f;
+  else
+    CLASSPATH=${CLASSPATH}:$f;
+  fi
 done
 
 # add the auxillary jars such as serdes
@@ -356,6 +365,10 @@ if [[ "$SERVICE" =~ ^(hiveserver2|beeline|cli)$ ]] ; then
   fi
 fi
 
+# include the log4j jar that is used for hive into the classpath
+CLASSPATH="${CLASSPATH}:${LOG_JAR_CLASSPATH}"
+export HADOOP_CLASSPATH="${HADOOP_CLASSPATH}:${LOG_JAR_CLASSPATH}"
+
 if [ "$TORUN" = "" ] ; then
   echo "Service $SERVICE not found"
   echo "Available Services: $SERVICE_LIST"

Reply via email to