From 9d2cb133f2284e6ce7ab2fb01eb28f9164563c33 Mon Sep 17 00:00:00 2001 From: zhangstar333 <87313068+zhangstar333@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:43:05 +0800 Subject: [PATCH] [fix](jdbc) fix logger error of statusLogger unrecognized (#14854) * [fix](jdbc) fix logger error of statusLogger unrecognized * update --- be/src/util/jni-util.cpp | 3 +- fe/java-udf/pom.xml | 6 +-- .../src/main/resources/log4j.properties | 26 ++++++++++++ fe/java-udf/src/main/resources/package.xml | 41 +++++++++++++++++++ 4 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 fe/java-udf/src/main/resources/log4j.properties create mode 100644 fe/java-udf/src/main/resources/package.xml diff --git a/be/src/util/jni-util.cpp b/be/src/util/jni-util.cpp index 731bf310e8..7327664b89 100644 --- a/be/src/util/jni-util.cpp +++ b/be/src/util/jni-util.cpp @@ -71,10 +71,11 @@ void FindOrCreateJavaVM() { if (rv == 0) { auto classpath = GetDorisJNIClasspath(); std::string heap_size = fmt::format("-Xmx{}", config::jvm_max_heap_size); - + std::string log_path = fmt::format("-DlogPath={}/log/udf-jdbc.log", getenv("DORIS_HOME")); JavaVMOption options[] = { {const_cast(classpath.c_str()), nullptr}, {const_cast(heap_size.c_str()), nullptr}, + {const_cast(log_path.c_str()), nullptr}, #ifdef __APPLE__ // On macOS, we should disable MaxFDLimit, otherwise the RLIMIT_NOFILE // will be assigned the minimum of OPEN_MAX (10240) and rlim_cur (See src/hotspot/os/bsd/os_bsd.cpp) diff --git a/fe/java-udf/pom.xml b/fe/java-udf/pom.xml index 3b0595442d..272bd2f5ac 100644 --- a/fe/java-udf/pom.xml +++ b/fe/java-udf/pom.xml @@ -82,9 +82,9 @@ under the License. maven-assembly-plugin - - jar-with-dependencies - + + src/main/resources/package.xml + diff --git a/fe/java-udf/src/main/resources/log4j.properties b/fe/java-udf/src/main/resources/log4j.properties new file mode 100644 index 0000000000..42de6dad48 --- /dev/null +++ b/fe/java-udf/src/main/resources/log4j.properties @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +log4j.rootLogger=INFO, RollingFile +log4j.appender.RollingFile=org.apache.log4j.RollingFileAppender +log4j.appender.RollingFile.Threshold=INFO +log4j.appender.RollingFile.File=${logPath} +log4j.appender.RollingFile.Append=true +log4j.appender.RollingFile.MaxFileSize=10MB +log4j.appender.RollingFile.MaxBackupIndex=5 +log4j.appender.RollingFile.layout=org.apache.log4j.PatternLayout +log4j.appender.RollingFile.layout.ConversionPattern= %d{yyyy-MM-dd HH:mm:ss} %5p %t %-5l - %m%n \ No newline at end of file diff --git a/fe/java-udf/src/main/resources/package.xml b/fe/java-udf/src/main/resources/package.xml new file mode 100644 index 0000000000..4bbb261060 --- /dev/null +++ b/fe/java-udf/src/main/resources/package.xml @@ -0,0 +1,41 @@ + + + + jar-with-dependencies + + jar + + false + + + / + true + true + runtime + + + **/Log4j2Plugins.dat + + + + +