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 08:58:16 UTC

[phoenix] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


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

commit df58e9c8a616c20f9b27ee3c0aeb5e17ae968052
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      |  3 ++-
 bin/pherf-standalone.py |  8 +++++++-
 bin/phoenix_utils.py    | 12 ++++++++++--
 bin/psql.py             |  1 +
 bin/sqlline.py          |  7 +++++--
 5 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/bin/performance.py b/bin/performance.py
index 0215806..212a1f6 100755
--- a/bin/performance.py
+++ b/bin/performance.py
@@ -101,7 +101,8 @@ execute = ('%s $PHOENIX_OPTS -cp "%s%s%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.slf4j_backend_jar, os.pathsep,
-     phoenix_utils.phoenix_client_embedded_jar, table, zookeeper)
+     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 86d6984..16617d6 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.slf4j_backend_jar + os.pathsep + phoenix_utils.phoenix_client_embedded_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 f58e113..012d09d 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
@@ -176,7 +178,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 ""
 
@@ -212,3 +219,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 9e2de5a..6c63a21 100755
--- a/bin/psql.py
+++ b/bin/psql.py
@@ -67,6 +67,7 @@ else:
 java_cmd = java + ' $PHOENIX_OPTS ' + \
     ' -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 3e1d6e9..5d95e0e 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -108,8 +108,11 @@ if os.name == 'nt':
     colorSetting = "false"
 
 java_cmd = java + ' $PHOENIX_OPTS ' + \
-    ' -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 + \
+    ' -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.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" + \