Skip to content

Commit

Permalink
PHOENIX-7477 Set java.util.logging.config.class in scripts (#2040)
Browse files Browse the repository at this point in the history
and add org.slf4:jul-to-slf4j to classpath where needed
  • Loading branch information
stoty authored Jan 14, 2025
1 parent 9af06d8 commit 0dda95a
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 4 deletions.
4 changes: 3 additions & 1 deletion bin/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def createFileWithContent(filename, content):

java_cmd = phoenix_utils.java

execute = ('%s %s $PHOENIX_OPTS -cp "%s%s%s%s%s"-Dlog4j2.configurationFile=file:' +
execute = ('%s %s $PHOENIX_OPTS -cp "%s%s%s%s%s"' +
' -Djava.util.logging.config.class=org.apache.hadoop.hbase.logging.JulToSlf4jInitializer ' +
' -Dlog4j2.configurationFile=file:' +
os.path.join(phoenix_utils.current_dir, "log4j2.properties") +
' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \
(java_cmd, phoenix_utils.jvm_module_flags, hbase_config_path, os.pathsep,
Expand Down
3 changes: 2 additions & 1 deletion bin/pherf-standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
phoenix_utils.logging_jar + os.pathsep + \
phoenix_utils.phoenix_client_embedded_jar + os.pathsep +\
phoenix_utils.phoenix_pherf_jar + \
'" -Dlog4j2.configurationFile=file:' + \
'" -Djava.util.logging.config.class=org.apache.hadoop.hbase.logging.JulToSlf4jInitializer ' +\
' -Dlog4j2.configurationFile=file:' + \
os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
" org.apache.phoenix.pherf.Pherf " + args

Expand Down
2 changes: 2 additions & 0 deletions bin/phoenix_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def setPath():
LOGGING_JAR_PATTERN = "log4j-core*.jar"
LOGGING_JAR_PATTERN2 = "log4j-api*.jar"
LOGGING_JAR_PATTERN3 = "log4j-1.2-api*.jar"
LOGGING_JAR_PATTERN4 = "jul-to-slf4j*.jar"
SQLLINE_WITH_DEPS_PATTERN = "sqlline-*-jar-with-dependencies.jar"


Expand Down Expand Up @@ -200,6 +201,7 @@ def setPath():
logging_jar = findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN, os.path.join(current_dir, "..","lib"))
logging_jar += ":"+findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN2, os.path.join(current_dir, "..","lib"))
logging_jar += ":"+findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN3, os.path.join(current_dir, "..","lib"))
logging_jar += ":"+findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN4, os.path.join(current_dir, "..","lib"))

__set_java_home()
__set_jvm_flags()
Expand Down
4 changes: 3 additions & 1 deletion bin/psql.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
' -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 + '" -Dlog4j2.configurationFile=file:' + \
os.pathsep + phoenix_utils.phoenix_client_embedded_jar + \
'" -Djava.util.logging.config.class=org.apache.hadoop.hbase.logging.JulToSlf4jInitializer ' + \
' -Dlog4j2.configurationFile=file:' + \
os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
" org.apache.phoenix.util.PhoenixRuntime " + args

Expand Down
3 changes: 2 additions & 1 deletion bin/sqlline.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def kill_child():
phoenix_utils.slf4j_backend_jar + os.pathsep + \
phoenix_utils.logging_jar + os.pathsep + \
phoenix_utils.phoenix_client_lite_jar + \
'" -Dlog4j2.configurationFile=file:' + os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
'" -Djava.util.logging.config.class=org.apache.hadoop.hbase.logging.JulToSlf4jInitializer ' + \
' -Dlog4j2.configurationFile=file:' + os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
disable_jna + \
" sqlline.SqlLine -d org.apache.phoenix.jdbc.PhoenixDriver" + \
(not args.noconnect and " -u " + phoenix_utils.shell_quote([jdbc_url]) or "") + \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<outputDirectory>/lib</outputDirectory>
<includes>
<include>sqlline:sqlline:jar:jar-with-dependencies</include>
<include>org.slf4j:jul-to-slf4j</include>
<include>org.apache.logging.log4j:log4j-slf4j-impl</include>
<include>org.apache.logging.log4j:log4j-api</include>
<include>org.apache.logging.log4j:log4j-core</include>
Expand Down
4 changes: 4 additions & 0 deletions phoenix-core-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions phoenix-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
<ignoredUnusedDeclaredDependency>
org.apache.logging.log4j:log4j-1.2-api
</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>
org.slf4j:jul-to-slf4j
</ignoredUnusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
<ignoredUsedUndeclaredDependencies>
</ignoredUsedUndeclaredDependencies>
Expand Down Expand Up @@ -462,6 +465,11 @@
</dependency>

<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions phoenix-pherf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down Expand Up @@ -311,6 +316,9 @@
<ignoredUnusedDeclaredDependency>
org.apache.logging.log4j:log4j-1.2-api
</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>
org.slf4j:jul-to-slf4j
</ignoredUnusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
<ignoredUsedUndeclaredDependencies>
<ignoredUsedUndeclaredDependency>
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,11 @@
<artifactId>slf4j-reload4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId> jul-to-slf4j </artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down

0 comments on commit 0dda95a

Please sign in to comment.