From e1a096f80c7b24967155f49444c195324ebe6c7a Mon Sep 17 00:00:00 2001 From: Frank Liu Date: Wed, 5 Apr 2023 10:34:02 -0700 Subject: [PATCH] [serving] Avoid compile time dependency on log4j (#603) --- gradle.properties | 2 +- serving/build.gradle | 5 +++-- .../java/ai/djl/serving/http/ManagementRequestHandler.java | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index e653895a83f..bf67a8cc749 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,6 +17,6 @@ commons_cli_version=1.5.0 netty_version=4.1.87.Final slf4j_version=1.7.36 log4j_slf4j_version=2.19.0 -snakeyaml_version=1.33 +snakeyaml_version=2.0 disruptor_version=3.4.4 testng_version=7.7.1 diff --git a/serving/build.gradle b/serving/build.gradle index 36f7ba06ae2..e2e7dfd3d3f 100644 --- a/serving/build.gradle +++ b/serving/build.gradle @@ -14,8 +14,9 @@ dependencies { //noinspection GradlePackageUpdate implementation "commons-cli:commons-cli:${commons_cli_version}" - implementation "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_slf4j_version}" - implementation "com.lmax:disruptor:${disruptor_version}" + + runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_slf4j_version}" + runtimeOnly "com.lmax:disruptor:${disruptor_version}" runtimeOnly "ai.djl:model-zoo" runtimeOnly "ai.djl.mxnet:mxnet-model-zoo" diff --git a/serving/src/main/java/ai/djl/serving/http/ManagementRequestHandler.java b/serving/src/main/java/ai/djl/serving/http/ManagementRequestHandler.java index 0bb20394631..dd413b40874 100644 --- a/serving/src/main/java/ai/djl/serving/http/ManagementRequestHandler.java +++ b/serving/src/main/java/ai/djl/serving/http/ManagementRequestHandler.java @@ -34,8 +34,6 @@ import io.netty.handler.codec.http.QueryStringDecoder; import io.netty.util.CharsetUtil; -import org.apache.logging.log4j.util.Strings; - import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; @@ -337,7 +335,7 @@ private void handleScaleWorkflow( } } - String combinedMsg = Strings.join(messages, '\n'); + String combinedMsg = String.join("\n", messages); NettyUtils.sendJsonResponse(ctx, new StatusResponse(combinedMsg)); } catch (NumberFormatException ex) { throw new BadRequestException("parameter is invalid number." + ex.getMessage(), ex);