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

[phoenix-queryserver] branch master updated: PHOENIX-6461 sqlline-thin does not include slf4j logging backend

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

richardantal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix-queryserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 2e480c0  PHOENIX-6461 sqlline-thin does not include slf4j logging backend
2e480c0 is described below

commit 2e480c01d0bf3e5fa1052bc4ab53ed86eeb3eaa2
Author: Richard Antal <ri...@cloudera.com>
AuthorDate: Mon Jun 7 20:17:25 2021 +0200

    PHOENIX-6461 sqlline-thin does not include slf4j logging backend
    
    Change-Id: I18eb654f5b73ee311ae346a6e23f2cd46349d447
---
 bin/phoenix_queryserver_utils.py                      | 9 +++++++++
 bin/sqlline-thin.py                                   | 2 +-
 phoenix-queryserver-assembly/pom.xml                  | 5 +++++
 phoenix-queryserver-assembly/src/assembly/cluster.xml | 7 +++++++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/bin/phoenix_queryserver_utils.py b/bin/phoenix_queryserver_utils.py
index 831b955..cbc8f1e 100755
--- a/bin/phoenix_queryserver_utils.py
+++ b/bin/phoenix_queryserver_utils.py
@@ -82,6 +82,9 @@ def setPath():
     PHOENIX_QUERYSERVER_JAR_PATTERN = "phoenix-queryserver-[!c]*.jar"
     PHOENIX_LOADBALANCER_JAR_PATTERN = "load-balancer-*[!t][!e][!s][!t][!s].jar"
     SQLLINE_WITH_DEPS_PATTERN = "sqlline-*-jar-with-dependencies.jar"
+    SLF4J_SIMPLE_JAR_PATTERN = "slf4j-simple-*[!s].jar"
+
+    OVERRIDE_SLF4J_BACKEND = "PHOENIX_THIN_OVERRIDE_SLF4J_BACKEND"
 
     # Backward support old env variable PHOENIX_LIB_DIR replaced by PHOENIX_CLASS_PATH
     global phoenix_class_path
@@ -153,6 +156,11 @@ def setPath():
     global sqlline_with_deps_jar
     sqlline_with_deps_jar = findFileInPathWithoutRecursion(SQLLINE_WITH_DEPS_PATTERN, os.path.join(current_dir, "..","lib"))
 
+    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_SIMPLE_JAR_PATTERN, os.path.join(current_dir, "..","lib"))
+
     return ""
 
 def shell_quote(args):
@@ -188,3 +196,4 @@ if __name__ == "__main__":
     print "phoenix_queryserver_classpath", phoenix_queryserver_classpath
     print "phoenix_thin_client_jar:", phoenix_thin_client_jar
     print "sqlline_with_deps_jar", sqlline_with_deps_jar
+    print "slf4j_backend_jar:", slf4j_backend_jar
diff --git a/bin/sqlline-thin.py b/bin/sqlline-thin.py
index 8e73bf4..c763f98 100755
--- a/bin/sqlline-thin.py
+++ b/bin/sqlline-thin.py
@@ -206,7 +206,7 @@ if (get_hbase_authentication() == 'kerberos' and get_spnego_auth_disabled() == '
 java_cmd = java + ' $PHOENIX_OPTS ' + \
     ' -cp "' + phoenix_queryserver_utils.sqlline_with_deps_jar \
     + os.pathsep + phoenix_queryserver_utils.phoenix_thin_client_jar + \
-    '" -Dlog4j.configuration=file:' + \
+    os.pathsep + phoenix_queryserver_utils.slf4j_backend_jar + '" -Dlog4j.configuration=file:' + \
     os.path.join(phoenix_queryserver_utils.current_dir, "log4j.properties") + \
     ' -Djavax.security.auth.useSubjectCredsOnly=false ' + \
     " org.apache.phoenix.queryserver.client.SqllineWrapper -d org.apache.phoenix.queryserver.client.Driver " + \
diff --git a/phoenix-queryserver-assembly/pom.xml b/phoenix-queryserver-assembly/pom.xml
index 30b9e4c..db727d7 100644
--- a/phoenix-queryserver-assembly/pom.xml
+++ b/phoenix-queryserver-assembly/pom.xml
@@ -46,6 +46,11 @@
             <artifactId>sqlline</artifactId>
             <classifier>jar-with-dependencies</classifier>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>${slf4j.version}</version>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/phoenix-queryserver-assembly/src/assembly/cluster.xml b/phoenix-queryserver-assembly/src/assembly/cluster.xml
index bb7daf0..f472e83 100644
--- a/phoenix-queryserver-assembly/src/assembly/cluster.xml
+++ b/phoenix-queryserver-assembly/src/assembly/cluster.xml
@@ -68,5 +68,12 @@
           <include>org.apache.phoenix:${phoenix.client.artifactid}:jar</include>
         </includes>
       </dependencySet>
+      <dependencySet>
+        <unpack>false</unpack>
+        <outputDirectory>phoenix-queryserver-${project.parent.version}/lib</outputDirectory>
+        <includes>
+          <include>org.slf4j:slf4j-simple</include>
+        </includes>
+      </dependencySet>
     </dependencySets>
 </assembly>