From 1dfc37915992608d54f8b7880d7c0189fbc1cfad Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Tue, 19 Mar 2024 20:21:47 +0800 Subject: [PATCH] [ISSUE #71] Reduce log file size and Streamline debug output (#72) * Refine logging level in different profiles * Console logs are no longer recorded * Reorder packages to avoid overwriting --- deployment/auto-deploy-eventmesh-dashboard.sh | 11 ++-- .../src/main/resources/application-dev.yml | 5 +- .../src/main/resources/logback-dev.xml | 50 ------------------- .../src/main/resources/logback.xml | 17 +++---- .../src/test/resources/application-test.yml | 6 ++- .../src/test/resources/logback-test.xml | 50 ------------------- 6 files changed, 19 insertions(+), 120 deletions(-) delete mode 100644 eventmesh-dashboard-console/src/main/resources/logback-dev.xml delete mode 100644 eventmesh-dashboard-console/src/test/resources/logback-test.xml diff --git a/deployment/auto-deploy-eventmesh-dashboard.sh b/deployment/auto-deploy-eventmesh-dashboard.sh index 24ca44be..62d40a75 100644 --- a/deployment/auto-deploy-eventmesh-dashboard.sh +++ b/deployment/auto-deploy-eventmesh-dashboard.sh @@ -26,9 +26,6 @@ PID_LOG=~/service/eventmesh-dashboard/deployment/eventmesh-dashboard-pid.log # Automatic deployment shell script log file path AUTO_DEPLOY_LOG=~/service/eventmesh-dashboard/deployment/auto-deploy-eventmesh-dashboard.log -# EventMesh Dashboard log file path -APP_LOG=~/service/eventmesh-dashboard/deployment/eventmesh-dashboard-$(date +"%Y-%m-%d-%H-%M-%S").log - # Jar file path JAR_FILE_PATH=~/service/eventmesh-dashboard/eventmesh-dashboard-console/target/eventmesh-dashboard-console-0.0.1-SNAPSHOT.jar @@ -62,8 +59,8 @@ if [ $LOCAL != $REMOTE ]; then # Compile and package the Jar file mvn clean package -DskipTests - # Start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-.log file - nohup java -DDB_ADDRESS=$DB_ADDRESS -DDB_USERNAME=$DB_USERNAME -DDB_PASSWORD=$DB_PASSWORD -jar $JAR_FILE_PATH > $APP_LOG 2>&1 & + # Start the springboot application and record the process id to pid.log file + nohup java -DDB_ADDRESS=$DB_ADDRESS -DDB_USERNAME=$DB_USERNAME -DDB_PASSWORD=$DB_PASSWORD -jar $JAR_FILE_PATH > /dev/null 2>&1 & echo $! > $PID_LOG # Log the event @@ -81,8 +78,8 @@ else # If the pid.log file does not exist, compile and package the Jar file mvn clean package -DskipTests - # Start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-.log file - nohup java -DDB_ADDRESS=$DB_ADDRESS -DDB_USERNAME=$DB_USERNAME -DDB_PASSWORD=$DB_PASSWORD -jar $JAR_FILE_PATH > $APP_LOG 2>&1 & + # Start the springboot application and record the process id to pid.log file + nohup java -DDB_ADDRESS=$DB_ADDRESS -DDB_USERNAME=$DB_USERNAME -DDB_PASSWORD=$DB_PASSWORD -jar $JAR_FILE_PATH > /dev/null 2>&1 & echo $! > $PID_LOG # Log the event diff --git a/eventmesh-dashboard-console/src/main/resources/application-dev.yml b/eventmesh-dashboard-console/src/main/resources/application-dev.yml index 73f471b0..b0cee4bc 100644 --- a/eventmesh-dashboard-console/src/main/resources/application-dev.yml +++ b/eventmesh-dashboard-console/src/main/resources/application-dev.yml @@ -45,7 +45,10 @@ spring: min-evictable-idle-time-millis: 300000 logging: - config: classpath:logback-dev.xml + level: + root: INFO + org.apache.eventmesh: DEBUG + org.apache.eventmesh.dashboard: DEBUG mybatis: type-aliases-package: org.apache.eventmesh.dashboard.console.entity diff --git a/eventmesh-dashboard-console/src/main/resources/logback-dev.xml b/eventmesh-dashboard-console/src/main/resources/logback-dev.xml deleted file mode 100644 index e86bb3ef..00000000 --- a/eventmesh-dashboard-console/src/main/resources/logback-dev.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n - - - - - ${user.home}/logs/eventmesh-dashboard.log - true - - ${user.home}/logs/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log - - - 104857600 - - 10 - - - [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n - UTF-8 - - - - - - - - - \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/main/resources/logback.xml b/eventmesh-dashboard-console/src/main/resources/logback.xml index c9925d33..57d00889 100644 --- a/eventmesh-dashboard-console/src/main/resources/logback.xml +++ b/eventmesh-dashboard-console/src/main/resources/logback.xml @@ -19,25 +19,20 @@ - [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %magenta(%-5level) %green(%logger{60}) - %msg%n - - ${user.home}/logs/eventmesh-dashboard.log - true + - ${user.home}/logs/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log - - - 104857600 + ${user.home}/logs/eventmesh-dashboard/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log + + 10485760 10 - [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{60} - %msg%n UTF-8 diff --git a/eventmesh-dashboard-console/src/test/resources/application-test.yml b/eventmesh-dashboard-console/src/test/resources/application-test.yml index 89dbea25..667ed41f 100644 --- a/eventmesh-dashboard-console/src/test/resources/application-test.yml +++ b/eventmesh-dashboard-console/src/test/resources/application-test.yml @@ -33,4 +33,8 @@ spring: validation-query-timeout: 15 test-on-borrow: false test-while-idle: true - min-evictable-idle-time-millis: 300000 \ No newline at end of file + min-evictable-idle-time-millis: 300000 + +logging: + level: + root: DEBUG \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/resources/logback-test.xml b/eventmesh-dashboard-console/src/test/resources/logback-test.xml deleted file mode 100644 index e86bb3ef..00000000 --- a/eventmesh-dashboard-console/src/test/resources/logback-test.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n - - - - - ${user.home}/logs/eventmesh-dashboard.log - true - - ${user.home}/logs/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log - - - 104857600 - - 10 - - - [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n - UTF-8 - - - - - - - - - \ No newline at end of file