Repository: hive Updated Branches: refs/heads/master 90f26bb44 -> be8a451d5
HIVE-18472 : Beeline gives log4j warnings (Janaki Lahorani, reviewed by Vihang Karajgaonkar) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/be8a451d Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/be8a451d Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/be8a451d Branch: refs/heads/master Commit: be8a451d5d5394d7893590c36a6395544cc0866e Parents: 90f26bb Author: Vihang Karajgaonkar <vih...@cloudera.com> Authored: Mon Jan 29 11:23:07 2018 -0800 Committer: Vihang Karajgaonkar <vih...@cloudera.com> Committed: Mon Jan 29 19:32:38 2018 -0800 ---------------------------------------------------------------------- bin/hive | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/be8a451d/bin/hive ---------------------------------------------------------------------- diff --git a/bin/hive b/bin/hive index 4a908e1..643bb74 100755 --- a/bin/hive +++ b/bin/hive @@ -131,8 +131,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 @@ -340,6 +349,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"