hailin0 commented on code in PR #3025:
URL:
https://github.com/apache/incubator-seatunnel/pull/3025#discussion_r992071893
##########
seatunnel-core/seatunnel-core-flink-sql/src/main/bin/start-seatunnel-sql.sh:
##########
@@ -50,15 +50,24 @@ else
args=$@
fi
+set +u
+# Log4j2 Config
+if [ -e "${CONF_DIR}/log4j2.properties" ]; then
+ JAVA_OPTS="${JAVA_OPTS}
-Dlog4j2.configurationFile=${CONF_DIR}/log4j2.properties"
+ JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.logs.path=${APP_DIR}/logs"
+ JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.logs.file_name=seatunnel-core-flink-sql"
+fi
+
+CLASS_PATH=${APP_DIR}/lib/logging/*:${APP_JAR}
-CMD=$(java -cp ${APP_JAR} ${APP_MAIN} ${args}) && EXIT_CODE=$? || EXIT_CODE=$?
+CMD=$(java ${JAVA_OPTS} -cp ${CLASS_PATH} ${APP_MAIN} ${args}) && EXIT_CODE=$?
|| EXIT_CODE=$?
if [ ${EXIT_CODE} -eq 234 ]; then
# print usage
echo "${CMD}"
exit 0
elif [ ${EXIT_CODE} -eq 0 ]; then
- echo "Execute SeaTunnel Flink SQL Job: ${CMD}"
- eval ${CMD}
+ echo "Execute SeaTunnel Flink SQL Job: $(echo "${CMD}" | tail -n 1)"
+ eval $(echo "${CMD}" | tail -n 1)
Review Comment:
tail last line text
##########
config/log4j2.properties:
##########
@@ -0,0 +1,77 @@
+################################################################################
+# 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.
+################################################################################
+
+property.file_path = ${sys:seatunnel.logs.path:-/tmp/seatunnel/logs}
+property.file_name = ${sys:seatunnel.logs.file_name:-seatunnel}
+property.file_split_size = 100MB
+property.file_count = 100
+property.file_ttl = 7d
Review Comment:
log files:
max bytes = 100MB * 100
max times = 7d
##########
config/log4j2.properties:
##########
@@ -0,0 +1,77 @@
+################################################################################
+# 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.
+################################################################################
+
+property.file_path = ${sys:seatunnel.logs.path:-/tmp/seatunnel/logs}
+property.file_name = ${sys:seatunnel.logs.file_name:-seatunnel}
+property.file_split_size = 100MB
+property.file_count = 100
+property.file_ttl = 7d
+rootLogger.level = INFO
+
+################################# console log #################################
+rootLogger.appenderRef.consoleInfo.ref = consoleInfo
+rootLogger.appenderRef.consoleWarn.ref = consoleWarn
+################################# console log #################################
+################################# file log #################################
+#rootLogger.appenderRef.file.ref = fileAppender
Review Comment:
Enable file log
##########
seatunnel-core/seatunnel-core-flink-sql/src/main/bin/start-seatunnel-sql.sh:
##########
@@ -50,15 +50,24 @@ else
args=$@
fi
+set +u
+# Log4j2 Config
+if [ -e "${CONF_DIR}/log4j2.properties" ]; then
+ JAVA_OPTS="${JAVA_OPTS}
-Dlog4j2.configurationFile=${CONF_DIR}/log4j2.properties"
+ JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.logs.path=${APP_DIR}/logs"
+ JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.logs.file_name=seatunnel-core-flink-sql"
Review Comment:
Add log4j2 system properties
##########
seatunnel-core/seatunnel-core-spark/src/main/bin/start-seatunnel-spark.sh:
##########
@@ -49,14 +49,24 @@ else
args=$@
fi
-CMD=$(java -cp ${APP_JAR} ${APP_MAIN} ${args}) && EXIT_CODE=$? || EXIT_CODE=$?
+set +u
+# Log4j2 Config
+if [ -e "${CONF_DIR}/log4j2.properties" ]; then
+ JAVA_OPTS="${JAVA_OPTS}
-Dlog4j2.configurationFile=${CONF_DIR}/log4j2.properties"
+ JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.logs.path=${APP_DIR}/logs"
+ JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.logs.file_name=seatunnel-core-spark"
+fi
+
+CLASS_PATH=${APP_DIR}/lib/logging/*:${APP_JAR}
+
+CMD=$(java ${JAVA_OPTS} -cp ${CLASS_PATH} ${APP_MAIN} ${args}) && EXIT_CODE=$?
|| EXIT_CODE=$?
if [ ${EXIT_CODE} -eq 234 ]; then
# print usage
echo "${CMD}"
exit 0
elif [ ${EXIT_CODE} -eq 0 ]; then
- echo "Execute SeaTunnel Spark Job: $(echo ${CMD} | tail -n 1)"
- eval $(echo ${CMD} | tail -n 1)
+ echo "Execute SeaTunnel Spark Job: $(echo "${CMD}" | tail -n 1)"
+ eval $(echo "${CMD}" | tail -n 1)
Review Comment:
Fix tail last line text: ${CMD} -> "${CMD}"
##########
seatunnel-core/seatunnel-core-flink-sql/src/main/bin/start-seatunnel-sql.sh:
##########
@@ -50,15 +50,24 @@ else
args=$@
fi
+set +u
+# Log4j2 Config
+if [ -e "${CONF_DIR}/log4j2.properties" ]; then
+ JAVA_OPTS="${JAVA_OPTS}
-Dlog4j2.configurationFile=${CONF_DIR}/log4j2.properties"
+ JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.logs.path=${APP_DIR}/logs"
+ JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.logs.file_name=seatunnel-core-flink-sql"
+fi
+
+CLASS_PATH=${APP_DIR}/lib/logging/*:${APP_JAR}
Review Comment:
add `lib/logging/` into starter jar classpath
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]