From 13fc9840d117552d4f9ce10b9dc5a0b88ae645be Mon Sep 17 00:00:00 2001 From: maobaolong Date: Mon, 19 Aug 2024 19:29:59 +0800 Subject: [PATCH] [MINOR] fix(script): Fix log4j2.xml script and intellij launch conf to support output audit logs (#2028) ### What changes were proposed in this pull request? Fix log4j2.xml script and intellij launch conf to support output audit logs ### Why are the changes needed? Without this PR, there are some issues - Extra empty logs file generated. - The audit logs cannot generated in logs folder when launch Uniffle servers from IntelliJ IDEA. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Start servers and check the logs. ``` ll incubator-uniffle/logs total 44K -rw-r--r-- 1 mbl staff 5.7K 8 9 17:36 coordinator.log -rw-r--r-- 1 mbl staff 625 8 9 17:36 coordinator_rpc_audit.log -rw-r--r-- 1 mbl staff 1.1K 8 9 17:34 dashboard.log -rw-r--r-- 1 mbl staff 15K 8 9 17:36 shuffle_server.log -rw-r--r-- 1 mbl staff 12K 8 9 17:36 shuffle_server_rpc_audit.log ``` --- bin/start-coordinator.sh | 2 +- bin/start-shuffle-server.sh | 2 +- conf/log4j2.xml | 19 +++++++------------ dev/intellij/install-runconfig.sh | 4 ++-- dev/intellij/runConfs/CoordinatorServer.run | 2 +- dev/intellij/runConfs/ShuffleServer.run | 2 +- dev/local_dev_template/log4j2.xml | 19 +++++++------------ 7 files changed, 20 insertions(+), 30 deletions(-) diff --git a/bin/start-coordinator.sh b/bin/start-coordinator.sh index 2e790f8a02..55b9c54398 100755 --- a/bin/start-coordinator.sh +++ b/bin/start-coordinator.sh @@ -97,7 +97,7 @@ GC_LOG_ARGS_NEW=" -XX:+IgnoreUnrecognizedVMOptions \ JVM_LOG_ARGS="" if [ -f ${LOG_CONF_FILE} ]; then - JVM_LOG_ARGS=" -Dlog4j2.configurationFile=file:${LOG_CONF_FILE} -Dlog.path=${LOG_PATH} -Dcoordinator.rpc.audit.log.path=${COORDINATOR_RPC_AUDIT_LOG_PATH}" + JVM_LOG_ARGS=" -Dlog4j2.configurationFile=file:${LOG_CONF_FILE} -Dlog.path=${LOG_PATH} -Drpc.audit.log.path=${COORDINATOR_RPC_AUDIT_LOG_PATH}" else echo "Exit with error: ${LOG_CONF_FILE} file doesn't exist." exit 1 diff --git a/bin/start-shuffle-server.sh b/bin/start-shuffle-server.sh index bc52c65eed..b98c667993 100755 --- a/bin/start-shuffle-server.sh +++ b/bin/start-shuffle-server.sh @@ -135,7 +135,7 @@ GC_LOG_ARGS_NEW=" -XX:+IgnoreUnrecognizedVMOptions \ JVM_LOG_ARGS="" if [ -f ${LOG_CONF_FILE} ]; then - JVM_LOG_ARGS=" -Dlog4j2.configurationFile=file:${LOG_CONF_FILE} -Dlog.path=${LOG_PATH} -Dshuffle.server.storage.audit.log.path=${SHUFFLE_SERVER_STORAGE_AUDIT_LOG_PATH} -Dshuffle.server.rpc.audit.log.path=${SHUFFLE_SERVER_RPC_AUDIT_LOG_PATH}" + JVM_LOG_ARGS=" -Dlog4j2.configurationFile=file:${LOG_CONF_FILE} -Dlog.path=${LOG_PATH} -Dstorage.audit.log.path=${SHUFFLE_SERVER_STORAGE_AUDIT_LOG_PATH} -Drpc.audit.log.path=${SHUFFLE_SERVER_RPC_AUDIT_LOG_PATH}" else echo "Exit with error: ${LOG_CONF_FILE} file doesn't exist." exit 1 diff --git a/conf/log4j2.xml b/conf/log4j2.xml index 3bbbb466b9..027ad1d34e 100644 --- a/conf/log4j2.xml +++ b/conf/log4j2.xml @@ -27,21 +27,16 @@ - + - - - - - - - - + @@ -63,13 +58,13 @@ - + - + - + diff --git a/dev/intellij/install-runconfig.sh b/dev/intellij/install-runconfig.sh index f290afa5ca..20dbb709ba 100755 --- a/dev/intellij/install-runconfig.sh +++ b/dev/intellij/install-runconfig.sh @@ -23,11 +23,11 @@ set -o errexit # exit the script if any statement returns a non-true return va SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" SRC_DIR="$SCRIPT_DIR/runConfs" -DEST_DIR="$SCRIPT_DIR/../../.idea/runConfigurations1/" +DEST_DIR="$SCRIPT_DIR/../../.idea/runConfigurations/" mkdir -p "$DEST_DIR" ls -1 "$SRC_DIR" | xargs -n1 -I FILE cp "$SRC_DIR/FILE" "$DEST_DIR/FILE.xml" SRC_DIR="$SCRIPT_DIR/../../dev/local_dev_template" -DEST_DIR="$SCRIPT_DIR/../../.idea/local_dev1/" +DEST_DIR="$SCRIPT_DIR/../../.idea/local_dev/" mkdir -p "$DEST_DIR" ls -1 "$SRC_DIR" | xargs -n1 -I FILE cp "$SRC_DIR/FILE" "$DEST_DIR" diff --git a/dev/intellij/runConfs/CoordinatorServer.run b/dev/intellij/runConfs/CoordinatorServer.run index 69ec9de907..c9aee0660b 100644 --- a/dev/intellij/runConfs/CoordinatorServer.run +++ b/dev/intellij/runConfs/CoordinatorServer.run @@ -20,7 +20,7 @@ - + - - - - - - - - + @@ -63,13 +58,13 @@ - + - + - +