[Enhancement] Separate JNI logs from be.out (#25826)

- separate JNI logs from be.out
- rolling out config 
- provide log4j-1 compatibility using [log4j 1.2
bridge](https://logging.apache.org/log4j/2.x/log4j-1.2-api.html)

Signed-off-by: miomiocat <284487410@qq.com>
This commit is contained in:
miomiocat 2023-06-25 17:33:00 +08:00 committed by GitHub
parent 6915ff8199
commit d139bde248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 23 deletions

View File

@ -972,7 +972,7 @@ install(FILES
${BASE_DIR}/../conf/be_test.conf
${BASE_DIR}/../conf/cn.conf
${BASE_DIR}/../conf/hadoop_env.sh
${BASE_DIR}/../conf/log4j.properties
${BASE_DIR}/../conf/log4j2.properties
DESTINATION ${OUTPUT_DIR}/conf)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "ASAN" OR "${CMAKE_BUILD_TYPE}" STREQUAL "LSAN")

View File

@ -420,7 +420,7 @@ if [ ${BUILD_BE} -eq 1 ]; then
cp -r -p ${STARROCKS_HOME}/be/output/conf/be_test.conf ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/cn.conf ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/hadoop_env.sh ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/log4j.properties ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/log4j2.properties ${STARROCKS_OUTPUT}/be/conf/
if [ "${BUILD_TYPE}" == "ASAN" ]; then
cp -r -p ${STARROCKS_HOME}/be/output/conf/asan_suppressions.conf ${STARROCKS_OUTPUT}/be/conf/
fi

View File

@ -1,19 +0,0 @@
# Copyright 2021-present StarRocks, Inc. All rights reserved.
#
# Licensed 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
#
# https:#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=ERROR, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.target=System.err
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p [%t] %F(%M:%L): %m%n

21
conf/log4j2.properties Normal file
View File

@ -0,0 +1,21 @@
status = error
dest = out
name = PropertiesConfig
appender.rolling.type = RollingFile
appender.rolling.name = rollingFileAppender
appender.rolling.fileName = ${env:STARROCKS_HOME:-/tmp}/log/jni.INFO.log
appender.rolling.filePattern = ${env:STARROCKS_HOME:-/tmp}/log/jni.INFO.log.%d{yyyyMMdd}
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yy/MM/dd HH:mm:ss} %p [%t] %M(%F:%L): %m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 7
rootLogger = INFO, rollingFileAppender
#logger.hdfs.name = org.apache.hadoop.hdfs
#logger.hdfs.level = DEBUG

View File

@ -20,6 +20,14 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
<build>
<finalName>starrocks-java-utils</finalName>
<plugins>

View File

@ -16,7 +16,6 @@
<maven.compiler.target>8</maven.compiler.target>
<java-extensions.home>${basedir}/../</java-extensions.home>
<paimon.version>0.4.0-incubating</paimon.version>
<log4j.version>2.17.1</log4j.version>
<slf4j.version>1.7.32</slf4j.version>
</properties>

View File

@ -24,7 +24,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<java.version>1.8</java.version>
<hikaricp.version>3.4.5</hikaricp.version>
<log4j.version>2.17.1</log4j.version>
<log4j.version>2.19.0</log4j.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<java-extensions.home>${basedir}</java-extensions.home>
</properties>