PHOENIX-6461 sqlline-thin does not include slf4j logging backend
Change-Id: I18eb654f5b73ee311ae346a6e23f2cd46349d447
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 @@
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 @@
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 @@
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 @@
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>