This is an automated email from the ASF dual-hosted git repository.
yuqi4733 pushed a commit to branch branch-1.1
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-1.1 by this push:
new 3101fe95f1 [#9547] improvement(logging): Update log4j2 configuration
for Iceberg/Lance REST servers (#9555)
3101fe95f1 is described below
commit 3101fe95f16b9955184dc81bb4a1ec449ea8ce3d
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Dec 25 16:21:28 2025 +0800
[#9547] improvement(logging): Update log4j2 configuration for Iceberg/Lance
REST servers (#9555)
### What changes were proposed in this pull request?
This pull request updates logging configurations for the Gravitino
Iceberg REST and Lance REST servers. It introduces new template files
for Log4j2 properties, refines the log file naming conventions, and
removes custom lineage logging configuration from the Iceberg REST
server chart.
**Logging configuration updates:**
* Added new Log4j2 property template files for
`gravitino-iceberg-rest-server` and `gravitino-lance-rest-server` to
standardize logging setup and file rotation policies.
[[1]](diffhunk://#diff-674c4dd2a8728c2490ddfeb125668ce987dcdac9ccf9805ee010d21bca5e7577R1-R52)
[[2]](diffhunk://#diff-3866f87f7331f9967c2bb78e7ea33af90d57fa3c66f60365e11559ee42270f46R1-R52)
**Iceberg REST server logging changes:**
* Renamed the log configuration file in the Iceberg REST server Helm
chart to `gravitino-iceberg-rest-log4j2.properties` and updated default
log path and server name variables for improved clarity and consistency.
**Lineage logging removal:**
* Removed the separate lineage log file configuration and associated
logger settings from the Iceberg REST server chart, simplifying the
logging setup.
### Why are the changes needed?
Gravitino, Iceberg REST, and Lance REST share the same log4j2.properties
file, which is not well-designed.
Fix: #9547
### Does this PR introduce _any_ user-facing change?
N/A.
### How was this patch tested?
Existing tests.
Co-authored-by: Mini Yu <[email protected]>
---
bin/gravitino-iceberg-rest-server.sh.template | 7 +--
bin/gravitino-lance-rest-server.sh.template | 7 +--
bin/gravitino.sh.template | 4 +-
...avitino-iceberg-rest-log4j2.properties.template | 52 ++++++++++++++++++++++
...gravitino-lance-rest-log4j2.properties.template | 52 ++++++++++++++++++++++
...es => gravitino-iceberg-rest-log4j2.properties} | 28 +-----------
6 files changed, 117 insertions(+), 33 deletions(-)
diff --git a/bin/gravitino-iceberg-rest-server.sh.template
b/bin/gravitino-iceberg-rest-server.sh.template
index 7278bae448..1c87a3a72a 100755
--- a/bin/gravitino-iceberg-rest-server.sh.template
+++ b/bin/gravitino-iceberg-rest-server.sh.template
@@ -146,9 +146,10 @@
GRAVITINO_SERVER_NAME=org.apache.gravitino.iceberg.server.GravitinoIcebergRESTSe
GRAVITINO_SIMPLE_SERVER_NAME=gravitino-iceberg-rest-server
JAVA_OPTS+=" -Dfile.encoding=UTF-8"
-JAVA_OPTS+="
-Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/log4j2.properties"
-JAVA_OPTS+=" -Dgravitino.log.path=${GRAVITINO_LOG_DIR} ${GRAVITINO_MEM}"
-JAVA_OPTS+=" -Dgravitino.server.name=${GRAVITINO_SIMPLE_SERVER_NAME}"
+JAVA_OPTS+="
-Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/gravitino-iceberg-rest-log4j2.properties"
+JAVA_OPTS+=" -Dgravitino.iceberg-rest-server.log.path=${GRAVITINO_LOG_DIR}"
+JAVA_OPTS+="
-Dgravitino.iceberg-rest-server.name=${GRAVITINO_SIMPLE_SERVER_NAME}"
+JAVA_OPTS+=" ${GRAVITINO_MEM}"
if [ "$JVM_VERSION" -eq 17 ]; then
JAVA_OPTS+=" -XX:+IgnoreUnrecognizedVMOptions"
JAVA_OPTS+=" --add-opens java.base/java.io=ALL-UNNAMED"
diff --git a/bin/gravitino-lance-rest-server.sh.template
b/bin/gravitino-lance-rest-server.sh.template
index 17f098903e..d0883a1536 100644
--- a/bin/gravitino-lance-rest-server.sh.template
+++ b/bin/gravitino-lance-rest-server.sh.template
@@ -146,9 +146,10 @@
GRAVITINO_SERVER_NAME=org.apache.gravitino.lance.server.GravitinoLanceRESTServer
GRAVITINO_SIMPLE_SERVER_NAME=gravitino-lance-rest-server
JAVA_OPTS+=" -Dfile.encoding=UTF-8"
-JAVA_OPTS+="
-Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/log4j2.properties"
-JAVA_OPTS+=" -Dgravitino.log.path=${GRAVITINO_LOG_DIR} ${GRAVITINO_MEM}"
-JAVA_OPTS+=" -Dgravitino.server.name=${GRAVITINO_SIMPLE_SERVER_NAME}"
+JAVA_OPTS+="
-Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/gravitino-lance-rest-log4j2.properties"
+JAVA_OPTS+=" -Dgravitino.lance-rest-server.log.path=${GRAVITINO_LOG_DIR}"
+JAVA_OPTS+="
-Dgravitino.lance-rest-server.name=${GRAVITINO_SIMPLE_SERVER_NAME}"
+JAVA_OPTS+=" ${GRAVITINO_MEM}"
if [ "$JVM_VERSION" -eq 17 ]; then
JAVA_OPTS+=" -XX:+IgnoreUnrecognizedVMOptions"
JAVA_OPTS+=" --add-opens java.base/java.io=ALL-UNNAMED"
diff --git a/bin/gravitino.sh.template b/bin/gravitino.sh.template
index e9e7fb637e..48331fe3af 100755
--- a/bin/gravitino.sh.template
+++ b/bin/gravitino.sh.template
@@ -147,8 +147,10 @@ GRAVITINO_SIMPLE_SERVER_NAME=gravitino-server
JAVA_OPTS+=" -Dfile.encoding=UTF-8"
JAVA_OPTS+="
-Dlog4j2.configurationFile=file://${GRAVITINO_CONF_DIR}/log4j2.properties"
-JAVA_OPTS+=" -Dgravitino.log.path=${GRAVITINO_LOG_DIR} ${GRAVITINO_MEM}"
+JAVA_OPTS+=" -Dgravitino.log.path=${GRAVITINO_LOG_DIR}"
JAVA_OPTS+=" -Dgravitino.server.name=${GRAVITINO_SIMPLE_SERVER_NAME}"
+JAVA_OPTS+=" ${GRAVITINO_MEM}"
+
if [ "$JVM_VERSION" -eq 17 ]; then
JAVA_OPTS+=" -XX:+IgnoreUnrecognizedVMOptions"
JAVA_OPTS+=" --add-opens java.base/java.io=ALL-UNNAMED"
diff --git a/conf/gravitino-iceberg-rest-log4j2.properties.template
b/conf/gravitino-iceberg-rest-log4j2.properties.template
new file mode 100644
index 0000000000..696d5a8878
--- /dev/null
+++ b/conf/gravitino-iceberg-rest-log4j2.properties.template
@@ -0,0 +1,52 @@
+#
+# 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.
+#
+
+status = warn
+
+# Log files location
+property.basePath = ${sys:gravitino.iceberg-rest-server.log.path}
+property.serverName = ${sys:gravitino.iceberg-rest-server.name}
+
+# RollingFileAppender name, pattern, path and rollover policy
+appender.rolling.type = RollingFile
+appender.rolling.name = fileLogger
+appender.rolling.fileName = ${basePath}/${serverName}.log
+appender.rolling.filePattern = ${basePath}/${serverName}_%d{yyyyMMdd}.log.gz
+appender.rolling.layout.type = PatternLayout
+appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} %level [%t] [%l]
- %msg%n
+appender.rolling.policies.type = Policies
+
+# RollingFileAppender rotation policy
+appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
+appender.rolling.policies.size.size = 10MB
+appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
+appender.rolling.policies.time.interval = 1
+appender.rolling.policies.time.modulate = true
+appender.rolling.strategy.type = DefaultRolloverStrategy
+appender.rolling.strategy.delete.type = Delete
+appender.rolling.strategy.delete.basePath = ${basePath}
+appender.rolling.strategy.delete.maxDepth = 10
+appender.rolling.strategy.delete.ifLastModified.type = IfLastModified
+
+# Delete all files older than 30 days
+appender.rolling.strategy.delete.ifLastModified.age = 30d
+
+# Configure root logger
+rootLogger.level = info
+rootLogger.appenderRef.rolling.ref = fileLogger
diff --git a/conf/gravitino-lance-rest-log4j2.properties.template
b/conf/gravitino-lance-rest-log4j2.properties.template
new file mode 100644
index 0000000000..bb8209d19f
--- /dev/null
+++ b/conf/gravitino-lance-rest-log4j2.properties.template
@@ -0,0 +1,52 @@
+#
+# 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.
+#
+
+status = warn
+
+# Log files location
+property.basePath = ${sys:gravitino.lance-rest-server.log.path}
+property.serverName = ${sys:gravitino.lance-rest-server.name}
+
+# RollingFileAppender name, pattern, path and rollover policy
+appender.rolling.type = RollingFile
+appender.rolling.name = fileLogger
+appender.rolling.fileName = ${basePath}/${serverName}.log
+appender.rolling.filePattern = ${basePath}/${serverName}_%d{yyyyMMdd}.log.gz
+appender.rolling.layout.type = PatternLayout
+appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} %level [%t] [%l]
- %msg%n
+appender.rolling.policies.type = Policies
+
+# RollingFileAppender rotation policy
+appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
+appender.rolling.policies.size.size = 10MB
+appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
+appender.rolling.policies.time.interval = 1
+appender.rolling.policies.time.modulate = true
+appender.rolling.strategy.type = DefaultRolloverStrategy
+appender.rolling.strategy.delete.type = Delete
+appender.rolling.strategy.delete.basePath = ${basePath}
+appender.rolling.strategy.delete.maxDepth = 10
+appender.rolling.strategy.delete.ifLastModified.type = IfLastModified
+
+# Delete all files older than 30 days
+appender.rolling.strategy.delete.ifLastModified.age = 30d
+
+# Configure root logger
+rootLogger.level = info
+rootLogger.appenderRef.rolling.ref = fileLogger
diff --git
a/dev/charts/gravitino-iceberg-rest-server/resources/log4j2.properties
b/dev/charts/gravitino-iceberg-rest-server/resources/gravitino-iceberg-rest-log4j2.properties
similarity index 59%
rename from dev/charts/gravitino-iceberg-rest-server/resources/log4j2.properties
rename to
dev/charts/gravitino-iceberg-rest-server/resources/gravitino-iceberg-rest-log4j2.properties
index cd0ce0ee90..5a49bc567b 100755
--- a/dev/charts/gravitino-iceberg-rest-server/resources/log4j2.properties
+++
b/dev/charts/gravitino-iceberg-rest-server/resources/gravitino-iceberg-rest-log4j2.properties
@@ -20,8 +20,8 @@
status = {{ .Values.log4j2Properties.status | default "warn" }}
# Log files location
-property.basePath = {{ .Values.log4j2Properties.basePath | default
"${sys:gravitino.log.path}" }}
-property.serverName = {{ .Values.log4j2Properties.serverName | default
"${sys:gravitino.server.name}" }}
+property.basePath = {{ .Values.log4j2Properties.basePath | default
"${sys:gravitino.iceberg-rest-server.log.path}" }}
+property.serverName = {{ .Values.log4j2Properties.serverName | default
"${sys:gravitino.iceberg-rest-server.name}" }}
# RollingFileAppender name, pattern, path and rollover policy
appender.rolling.type = {{ .Values.log4j2Properties.rollingAppenderType |
default "RollingFile" }}
@@ -47,30 +47,6 @@ appender.rolling.strategy.delete.ifLastModified.type = {{
.Values.log4j2Properti
# Delete all files older than 30 days
appender.rolling.strategy.delete.ifLastModified.age = {{
.Values.log4j2Properties.rollingAppenderStrategyDeleteIfLastModifiedAge |
default "30d" }}
-## use seperate file for lineage log
-appender.lineage_file.type = {{ .Values.log4j2Properties.lineageFileType |
default "RollingFile" }}
-appender.lineage_file.name = {{ .Values.log4j2Properties.lineageFileName |
default "lineage_file" }}
-appender.lineage_file.fileName = {{
.Values.log4j2Properties.lineageFileFileName | default
"${basePath}/gravitino_lineage.log" }}
-appender.lineage_file.filePattern = {{
.Values.log4j2Properties.lineageFilePattern | default
"${basePath}/gravitino_lineage_%d{yyyyMMdd}.log.gz" }}
-appender.lineage_file.layout.type = {{
.Values.log4j2Properties.lineageFileLayoutType | default "PatternLayout" }}
-appender.lineage_file.layout.pattern = {{
.Values.log4j2Properties.lineageFileLayoutPattern | default "[%d{yyyy-MM-dd
HH:mm:ss}] %m%n" }}
-
-appender.lineage_file.policies.type = {{
.Values.log4j2Properties.lineageFilePoliciesType | default "Policies" }}
-appender.lineage_file.policies.time.type = {{
.Values.log4j2Properties.lineageFilePoliciesTimeType | default
"TimeBasedTriggeringPolicy" }}
-appender.lineage_file.policies.time.interval = {{
.Values.log4j2Properties.lineageFilePoliciesTimeInterval | default 1 }}
-appender.lineage_file.policies.time.modulate = {{
.Values.log4j2Properties.lineageFilePoliciesTimeModulate | default true }}
-appender.lineage_file.strategy.type = {{
.Values.log4j2Properties.lineageFileStrategyType | default
"DefaultRolloverStrategy" }}
-appender.lineage_file.strategy.delete.type = {{
.Values.log4j2Properties.lineageFileStrategyDeleteType | default "Delete" }}
-appender.lineage_file.strategy.delete.basePath = {{
.Values.log4j2Properties.lineageFileStrategyDeleteBasePath | default
"${basePath}" }}
-appender.lineage_file.strategy.delete.maxDepth = {{
.Values.log4j2Properties.lineageFileStrategyDeleteMaxDepth | default 10 }}
-appender.lineage_file.strategy.delete.ifLastModified.type = {{
.Values.log4j2Properties.lineageFileStrategyDeleteIfLastModifiedType | default
"IfLastModified" }}
-appender.lineage_file.strategy.delete.ifLastModified.age = {{
.Values.log4j2Properties.lineageFileStrategyDeleteIfLastModifiedAge | default
"30d" }}
-
-logger.lineage.name = {{ .Values.log4j2Properties.lineageName | default
"org.apache.gravitino.lineage.sink.LineageLogSink$LineageLogger" }}
-logger.lineage.level = {{ .Values.log4j2Properties.lineageLevel | default
"info" }}
-logger.lineage.appenderRef.lineage_file.ref = {{
.Values.log4j2Properties.lineageAppenderRefLineageFileRef | default
"lineage_file" }}
-logger.lineage.additivity = {{ .Values.log4j2Properties.lineageAdditivity |
default false }}
-
# Configure root logger
rootLogger.level = {{ .Values.log4j2Properties.rootLoggerLevel | default
"info" }}
rootLogger.appenderRef.rolling.ref = {{
.Values.log4j2Properties.rootLoggerAppenderRefRollingRef | default "fileLogger"
}}