[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
diff --git a/deployment/auto-deploy-eventmesh-dashboard.sh b/deployment/auto-deploy-eventmesh-dashboard.sh
index 24ca44b..62d40a7 100644
--- a/deployment/auto-deploy-eventmesh-dashboard.sh
+++ b/deployment/auto-deploy-eventmesh-dashboard.sh
@@ -26,9 +26,6 @@
# 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 @@
# 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-<current time>.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 @@
# 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-<current time>.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 73f471b..b0cee4b 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 @@
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 e86bb3e..0000000
--- a/eventmesh-dashboard-console/src/main/resources/logback-dev.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder charset="UTF-8">
- <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n</pattern>
- </encoder>
- </appender>
-
- <appender name="FILE"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${user.home}/logs/eventmesh-dashboard.log</file>
- <append>true</append>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${user.home}/logs/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log
- </fileNamePattern>
- <timeBasedFileNamingAndTriggeringPolicy
- class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
- <maxFileSize>104857600</maxFileSize>
- </timeBasedFileNamingAndTriggeringPolicy>
- <MaxHistory>10</MaxHistory>
- </rollingPolicy>
- <encoder>
- <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n</pattern>
- <charset class="java.nio.charset.Charset">UTF-8</charset>
- </encoder>
- </appender>
-
- <root level="DEBUG">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="FILE" />
- </root>
-
-</configuration>
\ 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 c9925d3..57d0088 100644
--- a/eventmesh-dashboard-console/src/main/resources/logback.xml
+++ b/eventmesh-dashboard-console/src/main/resources/logback.xml
@@ -19,25 +19,20 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="UTF-8">
- <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n</pattern>
+ <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %magenta(%-5level) %green(%logger{60}) - %msg%n</pattern>
</encoder>
</appender>
- <appender name="FILE"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${user.home}/logs/eventmesh-dashboard.log</file>
- <append>true</append>
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${user.home}/logs/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log
- </fileNamePattern>
- <timeBasedFileNamingAndTriggeringPolicy
- class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
- <maxFileSize>104857600</maxFileSize>
+ <fileNamePattern>${user.home}/logs/eventmesh-dashboard/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ <maxFileSize>10485760</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<MaxHistory>10</MaxHistory>
</rollingPolicy>
<encoder>
- <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n</pattern>
+ <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{60} - %msg%n</pattern>
<charset class="java.nio.charset.Charset">UTF-8</charset>
</encoder>
</appender>
diff --git a/eventmesh-dashboard-console/src/test/resources/application-test.yml b/eventmesh-dashboard-console/src/test/resources/application-test.yml
index 89dbea2..667ed41 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 @@
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 e86bb3e..0000000
--- a/eventmesh-dashboard-console/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder charset="UTF-8">
- <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n</pattern>
- </encoder>
- </appender>
-
- <appender name="FILE"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${user.home}/logs/eventmesh-dashboard.log</file>
- <append>true</append>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${user.home}/logs/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log
- </fileNamePattern>
- <timeBasedFileNamingAndTriggeringPolicy
- class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
- <maxFileSize>104857600</maxFileSize>
- </timeBasedFileNamingAndTriggeringPolicy>
- <MaxHistory>10</MaxHistory>
- </rollingPolicy>
- <encoder>
- <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n</pattern>
- <charset class="java.nio.charset.Charset">UTF-8</charset>
- </encoder>
- </appender>
-
- <root level="DEBUG">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="FILE" />
- </root>
-
-</configuration>
\ No newline at end of file