You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2022/02/26 09:05:02 UTC

[phoenix] branch 4.16 updated: PHOENIX-6636 Replace bundled log4j libraries with reload4j (addendum: fix python scripts)

This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch 4.16
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.16 by this push:
     new 64d6313  PHOENIX-6636 Replace bundled log4j libraries with reload4j (addendum: fix python scripts)
64d6313 is described below

commit 64d631348254e002ac1f6d163558011672416fc7
Author: Istvan Toth <st...@apache.org>
AuthorDate: Sat Feb 26 09:55:59 2022 +0100

    PHOENIX-6636 Replace bundled log4j libraries with reload4j (addendum: fix python scripts)
---
 bin/performance.py      |  4 +++-
 bin/pherf-standalone.py |  8 +++++++-
 bin/phoenix_utils.py    | 12 ++++++++++--
 bin/psql.py             |  6 ++++--
 bin/sqlline.py          | 11 ++++++-----
 5 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/bin/performance.py b/bin/performance.py
index 16fee48..6107c93 100755
--- a/bin/performance.py
+++ b/bin/performance.py
@@ -100,7 +100,9 @@ else:
 execute = ('%s $PHOENIX_OPTS -cp "%s%s%s" -Dlog4j.configuration=file:' +
            os.path.join(phoenix_utils.current_dir, "log4j.properties") +
            ' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \
-    (java_cmd, hbase_config_path, os.pathsep, phoenix_utils.phoenix_client_jar, table, zookeeper)
+    (java_cmd, hbase_config_path, os.pathsep, phoenix_utils.slf4j_backend_jar, os.pathsep,
+     phoenix_utils.logging_jar, os.pathsep, phoenix_utils.phoenix_client_embedded_jar,
+     table, zookeeper)
 
 # Create Table DDL
 createtable = "CREATE TABLE IF NOT EXISTS %s (HOST CHAR(2) NOT NULL,\
diff --git a/bin/pherf-standalone.py b/bin/pherf-standalone.py
index b87585e..9e6b11c 100755
--- a/bin/pherf-standalone.py
+++ b/bin/pherf-standalone.py
@@ -64,7 +64,13 @@ if java_home:
 else:
     java = 'java'
 
-java_cmd = java +' -Xms512m -Xmx3072m  -cp "' + phoenix_utils.pherf_conf_path + os.pathsep + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_jar + os.pathsep + phoenix_utils.phoenix_pherf_jar + \
+java_cmd = java +' -Xms512m -Xmx3072m  -cp "' + \
+    phoenix_utils.pherf_conf_path + os.pathsep + \
+    phoenix_utils.hbase_conf_dir + os.pathsep + \
+    phoenix_utils.slf4j_backend_jar + os.pathsep + \
+    phoenix_utils.logging_jar + os.pathsep + \
+    phoenix_utils.phoenix_client_embedded_jar + os.pathsep +\
+    phoenix_utils.phoenix_pherf_jar + \
     '" -Dlog4j.configuration=file:' + \
     os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
     " org.apache.phoenix.pherf.Pherf " + args 
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index d5cfab6..4ba8255 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -81,11 +81,13 @@ def setPath():
     PHOENIX_TRACESERVER_JAR_PATTERN = "phoenix-tracing-webapp-*-runnable.jar"
     PHOENIX_TESTS_JAR_PATTERN = "phoenix-core-*-tests*.jar"
     PHOENIX_PHERF_JAR_PATTERN = "phoenix-pherf-*[!s].jar"
-    SLF4J_LOG4J12_JAR_PATTERN = "slf4j-log4j12-*[!s].jar"
+    SLF4J_BACKEND_JAR_PATTERN = "slf4j-reload4j-*[!s].jar"
+    LOGGING_JAR_PATTERN = "reload4j-*[!s].jar"
     SQLLINE_WITH_DEPS_PATTERN = "sqlline-*-jar-with-dependencies.jar"
 
 
     OVERRIDE_SLF4J_BACKEND = "OVERRIDE_SLF4J_BACKEND_JAR_LOCATION"
+    OVERRIDE_LOGGING = "OVERRIDE_LOGGING_JAR_LOCATION"
     OVERRIDE_SQLLINE = "OVERRIDE_SQLLINE_JAR_LOCATION"
 
     # Backward support old env variable PHOENIX_LIB_DIR replaced by PHOENIX_CLASS_PATH
@@ -190,7 +192,12 @@ def setPath():
     global slf4j_backend_jar
     slf4j_backend_jar = os.environ.get(OVERRIDE_SLF4J_BACKEND)
     if slf4j_backend_jar is None or slf4j_backend_jar == "":
-        slf4j_backend_jar = findFileInPathWithoutRecursion(SLF4J_LOG4J12_JAR_PATTERN, os.path.join(current_dir, "..","lib"))
+        slf4j_backend_jar = findFileInPathWithoutRecursion(SLF4J_BACKEND_JAR_PATTERN, os.path.join(current_dir, "..","lib"))
+
+    global logging_jar
+    logging_jar = os.environ.get(OVERRIDE_LOGGING)
+    if logging_jar is None or logging_jar == "":
+        logging_jar = findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN, os.path.join(current_dir, "..","lib"))
 
     return ""
 
@@ -231,3 +238,4 @@ if __name__ == "__main__":
     print("hadoop_classpath:", hadoop_classpath)
     print("sqlline_with_deps_jar:", sqlline_with_deps_jar)
     print("slf4j_backend_jar:", slf4j_backend_jar)
+    print("logging_jar:", logging_jar)
diff --git a/bin/psql.py b/bin/psql.py
index 0e57c77..1e0342d 100755
--- a/bin/psql.py
+++ b/bin/psql.py
@@ -65,8 +65,10 @@ else:
     java = 'java'
 
 java_cmd = java + ' $PHOENIX_OPTS ' + \
-    ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_jar + \
-    os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + phoenix_utils.hadoop_classpath + '" -Dlog4j.configuration=file:' + \
+    ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.hadoop_conf + \
+    os.pathsep + phoenix_utils.slf4j_backend_jar + \
+    os.pathsep + phoenix_utils.logging_jar + \
+    os.pathsep + phoenix_utils.phoenix_client_embedded_jar + '" -Dlog4j.configuration=file:' + \
     os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
     " org.apache.phoenix.util.PhoenixRuntime " + args 
 
diff --git a/bin/sqlline.py b/bin/sqlline.py
index be0637d..4a2d62f 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -108,12 +108,13 @@ if os.name == 'nt':
     colorSetting = "false"
 
 java_cmd = java + ' $PHOENIX_OPTS ' + \
-    ' -cp "' + phoenix_utils.sqlline_with_deps_jar + os.pathsep + hbase_config_path + os.pathsep + \
+    ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + \
+    phoenix_utils.hadoop_conf + os.pathsep + \
+    phoenix_utils.sqlline_with_deps_jar + os.pathsep + \
     phoenix_utils.slf4j_backend_jar + os.pathsep + \
-    phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_embedded_jar + \
-    os.pathsep + phoenix_utils.hadoop_common_jar + os.pathsep + phoenix_utils.hadoop_hdfs_jar + \
-    os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + phoenix_utils.hadoop_classpath + '" -Dlog4j.configuration=file:' + \
-    os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
+    phoenix_utils.logging_jar + os.pathsep + \
+    phoenix_utils.phoenix_client_embedded_jar + \
+    '" -Dlog4j.configuration=file:' + os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
     " sqlline.SqlLine -d org.apache.phoenix.jdbc.PhoenixDriver" + \
     " -u jdbc:phoenix:" + phoenix_utils.shell_quote([zookeeper]) + \
     " -n none -p none --color=" + colorSetting + " --fastConnect=" + tryDecode(args.fastconnect) + \