فهرست منبع

upgrade spring-boot to 2.4.2 and spring-cloud to 2020.0.1

Jason Song 4 سال پیش
والد
کامیت
fbec10dee4
29فایلهای تغییر یافته به همراه190 افزوده شده و 109 حذف شده
  1. 5 0
      apollo-adminservice/pom.xml
  2. 1 1
      apollo-adminservice/src/main/resources/adminservice.properties
  3. 23 2
      apollo-adminservice/src/main/resources/application.yml
  4. 0 19
      apollo-adminservice/src/main/resources/bootstrap.yml
  5. 1 1
      apollo-adminservice/src/main/scripts/startup.sh
  6. 1 1
      apollo-adminservice/src/test/resources/application.properties
  7. 19 1
      apollo-adminservice/src/test/resources/application.yml
  8. 0 16
      apollo-adminservice/src/test/resources/bootstrap.yml
  9. 27 1
      apollo-assembly/src/main/resources/application.yml
  10. 4 0
      apollo-common/pom.xml
  11. 4 4
      apollo-common/src/main/resources/application.properties
  12. 4 0
      apollo-configservice/pom.xml
  13. 25 1
      apollo-configservice/src/main/resources/application.yml
  14. 0 22
      apollo-configservice/src/main/resources/bootstrap.yml
  15. 1 1
      apollo-configservice/src/main/resources/configservice.properties
  16. 1 1
      apollo-configservice/src/main/scripts/startup.sh
  17. 2 0
      apollo-configservice/src/test/resources/application.properties
  18. 20 2
      apollo-configservice/src/test/resources/application.yml
  19. 0 16
      apollo-configservice/src/test/resources/bootstrap.yml
  20. 4 3
      apollo-portal/src/main/resources/application.yml
  21. 1 1
      apollo-portal/src/main/scripts/startup.sh
  22. 2 1
      apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/controller/ItemControllerTest.java
  23. 1 0
      apollo-portal/src/test/resources/application.properties
  24. 3 2
      apollo-portal/src/test/resources/application.yml
  25. 4 4
      docs/zh/development/apollo-development-guide.md
  26. 34 6
      pom.xml
  27. 1 1
      scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh
  28. 1 1
      scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh
  29. 1 1
      scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh

+ 5 - 0
apollo-adminservice/pom.xml

@@ -59,6 +59,11 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
+		<dependency>
+			<groupId>com.sun.jersey.contribs</groupId>
+			<artifactId>jersey-apache-client4</artifactId>
+			<scope>test</scope>
+		</dependency>
 		<dependency>
 			<groupId>com.h2database</groupId>
 			<artifactId>h2</artifactId>

+ 1 - 1
apollo-adminservice/src/main/resources/adminservice.properties

@@ -2,5 +2,5 @@
 spring.application.name= apollo-adminservice
 ctrip.appid= 100003172
 server.port= 8090
-logging.file= /opt/logs/100003172/apollo-adminservice.log
+logging.file.name= /opt/logs/100003172/apollo-adminservice.log
 spring.jmx.default-domain = apollo-adminservice

+ 23 - 2
apollo-adminservice/src/main/resources/application.yml

@@ -9,6 +9,27 @@ ctrip:
   
 server:
   port: 8090
-  
+
 logging:
-  file: /opt/logs/100003172/apollo-adminservice.log
+  file:
+    name: /opt/logs/100003172/apollo-adminservice.log
+
+eureka:
+  instance:
+    hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
+  client:
+    serviceUrl:
+      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
+      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
+      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
+    healthcheck:
+      enabled: true
+    eurekaServiceUrlPollIntervalSeconds: 60
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP

+ 0 - 19
apollo-adminservice/src/main/resources/bootstrap.yml

@@ -1,19 +0,0 @@
-eureka:
-  instance:
-    hostname: ${hostname:localhost}
-    preferIpAddress: true
-    status-page-url-path: /info
-    health-check-url-path: /health
-  client:
-    serviceUrl:
-      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
-      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
-      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
-    healthcheck:
-      enabled: true
-    eurekaServiceUrlPollIntervalSeconds: 60
-
-management:
-  health:
-    status:
-      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

+ 1 - 1
apollo-adminservice/src/main/scripts/startup.sh

@@ -24,7 +24,7 @@ then
     export SPRING_DATASOURCE_USERNAME=$DS_USERNAME
     export SPRING_DATASOURCE_PASSWORD=$DS_PASSWORD
 fi
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 export APP_NAME=$SERVICE_NAME
 
 PATH_TO_JAR=$SERVICE_NAME".jar"

+ 1 - 1
apollo-adminservice/src/test/resources/application.properties

@@ -3,4 +3,4 @@ spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.Ph
 spring.jpa.properties.hibernate.show_sql=false
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true
-
+spring.main.allow-bean-definition-overriding=true

+ 19 - 1
apollo-adminservice/src/test/resources/application.yml

@@ -8,7 +8,25 @@ server:
 logging:
   level:
     org.springframework.cloud: 'DEBUG'
-  file: /opt/logs/${ctrip.appid}/apollo-adminservice.log
+  file:
+    name: /opt/logs/${ctrip.appid}/apollo-adminservice.log
 
 ctrip:
   appid: 100003172
+
+eureka:
+  instance:
+    hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
+  client:
+    serviceUrl:
+      defaultZone: http://${eureka.instance.hostname}:8090/eureka/
+    healthcheck:
+      enabled: true
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP

+ 0 - 16
apollo-adminservice/src/test/resources/bootstrap.yml

@@ -1,16 +0,0 @@
-eureka:
-  instance:
-    hostname: ${hostname:localhost}
-    preferIpAddress: true
-    status-page-url-path: /info
-    health-check-url-path: /health
-  client:
-    serviceUrl:
-      defaultZone: http://${eureka.instance.hostname}:8090/eureka/
-    healthcheck:
-      enabled: true
-      
-management:
-  health:
-    status:
-      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

+ 27 - 1
apollo-assembly/src/main/resources/application.yml

@@ -3,4 +3,30 @@ spring:
     active: ${apollo_profile}
 
 logging:
-  file: /opt/logs/100003171/apollo-assembly.log
+  file:
+    name: /opt/logs/100003171/apollo-assembly.log
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
+    ldap:
+      enabled: false
+
+eureka:
+  instance:
+    hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
+  server:
+    peerEurekaNodesUpdateIntervalMs: 60000
+    enableSelfPreservation: false
+  client:
+    serviceUrl:
+      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
+      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
+      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
+    healthcheck:
+      enabled: true
+    eurekaServiceUrlPollIntervalSeconds: 60

+ 4 - 0
apollo-common/pom.xml

@@ -26,6 +26,10 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-validation</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-security</artifactId>

+ 4 - 4
apollo-common/src/main/resources/application.properties

@@ -1,4 +1,4 @@
-spring.http.converters.preferred-json-mapper=gson
+spring.mvc.converters.preferred-json-mapper=gson
 
 # DataSource
 spring.datasource.hikari.connectionInitSql=set names utf8mb4
@@ -14,10 +14,10 @@ server.tomcat.accept-count=5000
 # Increase tomcat header size for longer GET query parameter, should be n * 1024
 server.max-http-header-size=10240
 
-# Spring Boot 2.0
+# Spring Boot 2.x
 management.endpoints.web.base-path=/
-logging.file.max-size=50MB
-logging.file.max-history=10
+logging.logback.rollingpolicy.max-file-size=50MB
+logging.logback.rollingpolicy.max-history=10
 
 management.endpoints.web.exposure.include=info,health,metrics,prometheus
 

+ 4 - 0
apollo-configservice/pom.xml

@@ -64,6 +64,10 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
+		<dependency>
+			<groupId>com.sun.jersey.contribs</groupId>
+			<artifactId>jersey-apache-client4</artifactId>
+		</dependency>
 		<!-- end of eureka -->
 		<dependency>
 			<groupId>com.alibaba.nacos</groupId>

+ 25 - 1
apollo-configservice/src/main/resources/application.yml

@@ -11,4 +11,28 @@ server:
   port: 8080
 
 logging:
-  file: /opt/logs/100003171/apollo-configservice.log
+  file:
+    name: /opt/logs/100003171/apollo-configservice.log
+
+eureka:
+  instance:
+    hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
+  server:
+    peerEurekaNodesUpdateIntervalMs: 60000
+    enableSelfPreservation: false
+  client:
+    serviceUrl:
+      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
+      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
+      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
+    healthcheck:
+      enabled: true
+    eurekaServiceUrlPollIntervalSeconds: 60
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP

+ 0 - 22
apollo-configservice/src/main/resources/bootstrap.yml

@@ -1,22 +0,0 @@
-eureka:
-  instance:
-    hostname: ${hostname:localhost}
-    preferIpAddress: true
-    status-page-url-path: /info
-    health-check-url-path: /health
-  server:
-    peerEurekaNodesUpdateIntervalMs: 60000
-    enableSelfPreservation: false
-  client:
-    serviceUrl:
-      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
-      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
-      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
-    healthcheck:
-      enabled: true
-    eurekaServiceUrlPollIntervalSeconds: 60
-
-management:
-  health:
-    status:
-      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP

+ 1 - 1
apollo-configservice/src/main/resources/configservice.properties

@@ -2,5 +2,5 @@
 spring.application.name= apollo-configservice
 ctrip.appid= 100003171
 server.port= 8080
-logging.file= /opt/logs/100003171/apollo-configservice.log
+logging.file.name= /opt/logs/100003171/apollo-configservice.log
 spring.jmx.default-domain = apollo-configservice

+ 1 - 1
apollo-configservice/src/main/scripts/startup.sh

@@ -24,7 +24,7 @@ then
     export SPRING_DATASOURCE_USERNAME=$DS_USERNAME
     export SPRING_DATASOURCE_PASSWORD=$DS_PASSWORD
 fi
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 export APP_NAME=$SERVICE_NAME
 
 PATH_TO_JAR=$SERVICE_NAME".jar"

+ 2 - 0
apollo-configservice/src/test/resources/application.properties

@@ -4,5 +4,7 @@ spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true
 spring.jpa.properties.hibernate.show_sql=false
 
+spring.main.allow-bean-definition-overriding=true
+
 # for ReleaseMessageScanner test
 apollo.message-scan.interval=100

+ 20 - 2
apollo-configservice/src/test/resources/application.yml

@@ -8,7 +8,25 @@ server:
 logging:
   level:
     org.springframework.cloud: 'DEBUG'
-  file: /opt/logs/${ctrip.appid}/apollo-configservice.log
+  file:
+    name: /opt/logs/${ctrip.appid}/apollo-configservice.log
 
 ctrip:
-  appid: 100003171
+  appid: 100003171
+
+eureka:
+  instance:
+    hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
+  client:
+    serviceUrl:
+      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
+    healthcheck:
+      enabled: true
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP

+ 0 - 16
apollo-configservice/src/test/resources/bootstrap.yml

@@ -1,16 +0,0 @@
-eureka:
-  instance:
-    hostname: ${hostname:localhost}
-    preferIpAddress: true
-    status-page-url-path: /info
-    health-check-url-path: /health
-  client:
-    serviceUrl:
-      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
-    healthcheck:
-      enabled: true
-      
-management:
-  health:
-    status:
-      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

+ 4 - 3
apollo-portal/src/main/resources/application.yml

@@ -17,11 +17,12 @@ server:
     use-relative-redirects: true
 
 logging:
-  file: /opt/logs/100003173/apollo-portal.log
+  file:
+    name: /opt/logs/100003173/apollo-portal.log
 
 management:
   health:
     status:
       order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
-
-
+    ldap:
+      enabled: false # disable ldap health check by default

+ 1 - 1
apollo-portal/src/main/scripts/startup.sh

@@ -24,7 +24,7 @@ then
     export SPRING_DATASOURCE_USERNAME=$DS_USERNAME
     export SPRING_DATASOURCE_PASSWORD=$DS_PASSWORD
 fi
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 export APP_NAME=$SERVICE_NAME
 
 PATH_TO_JAR=$SERVICE_NAME".jar"

+ 2 - 1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/controller/ItemControllerTest.java

@@ -17,6 +17,7 @@ import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.yaml.snakeyaml.constructor.ConstructorException;
+import org.yaml.snakeyaml.constructor.DuplicateKeyException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class ItemControllerTest {
@@ -46,7 +47,7 @@ public class ItemControllerTest {
     itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml));
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test(expected = DuplicateKeyException.class)
   public void yamlSyntaxCheckWithDuplicatedValue() throws Exception {
     String yaml = loadYaml("case2.yaml");
 

+ 1 - 0
apollo-portal/src/test/resources/application.properties

@@ -3,3 +3,4 @@ spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.Ph
 spring.jpa.properties.hibernate.show_sql=false
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true
+spring.main.allow-bean-definition-overriding=true

+ 3 - 2
apollo-portal/src/test/resources/application.yml

@@ -8,8 +8,9 @@ spring:
 logging:
   level:
     org.springframework.cloud: 'DEBUG'
-  file: /opt/logs/100003173/apollo-portal.log
-  
+  file:
+    name: /opt/logs/100003173/apollo-portal.log
+
 apollo:
   portal:
     envs: local

+ 4 - 4
docs/zh/development/apollo-development-guide.md

@@ -46,9 +46,9 @@ Apollo本地开发需要以下组件:
 
 >注1:spring.datasource相关配置替换成你自己的数据库连接信息,注意数据库是`ApolloConfigDB`
 >
->注2:程序默认日志输出为/opt/logs/100003171/apollo-assembly.log,如果需要修改日志文件路径,可以增加`logging.file`参数,如下:
+>注2:程序默认日志输出为/opt/logs/100003171/apollo-assembly.log,如果需要修改日志文件路径,可以增加`logging.file.name`参数,如下:
 >
->-Dlogging.file=/your-path/apollo-assembly.log
+>-Dlogging.file.name=/your-path/apollo-assembly.log
 
 ### 2.1.4 Program arguments配置
 `--configservice --adminservice`
@@ -92,9 +92,9 @@ Apollo本地开发需要以下组件:
 >
 >注4:这里指定了server.port=8070是因为`apollo-configservice`启动在8080端口,所以这里配置`apollo-portal`启动在8070端口。
 >
->注5:程序默认日志输出为/opt/logs/100003173/apollo-portal.log,如果需要修改日志文件路径,可以增加`logging.file`参数,如下:
+>注5:程序默认日志输出为/opt/logs/100003173/apollo-portal.log,如果需要修改日志文件路径,可以增加`logging.file.name`参数,如下:
 >
->-Dlogging.file=/your-path/apollo-portal.log
+>-Dlogging.file.name=/your-path/apollo-portal.log
 
 ### 2.2.4 运行
 对新建的运行配置点击Run或Debug皆可。

+ 34 - 6
pom.xml

@@ -76,9 +76,8 @@
 		<revision>1.8.0-SNAPSHOT</revision>
 		<java.version>1.8</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<platform-bom.version>Cairo-SR4</platform-bom.version>
-		<spring-boot.version>2.0.5.RELEASE</spring-boot.version>
-		<spring-cloud.version>Finchley.SR1</spring-cloud.version>
+		<spring-boot.version>2.4.2</spring-boot.version>
+		<spring-cloud.version>2020.0.1</spring-cloud.version>
 		<jaxb.version>2.3.0</jaxb.version>
 		<javax.activation.version>1.1.1</javax.activation.version>
 		<javax.mail.version>1.6.2</javax.mail.version>
@@ -289,6 +288,11 @@
 				<artifactId>guice</artifactId>
 				<version>4.1.0</version>
 			</dependency>
+			<dependency>
+				<groupId>commons-lang</groupId>
+				<artifactId>commons-lang</artifactId>
+				<version>2.6</version>
+			</dependency>
 			<!--for test -->
 			<dependency>
 				<groupId>com.h2database</groupId>
@@ -302,11 +306,17 @@
 				<version>4.0.3</version>
 				<scope>test</scope>
 			</dependency>
+			<dependency>
+				<groupId>org.junit.vintage</groupId>
+				<artifactId>junit-vintage-engine</artifactId>
+				<version>5.7.0</version>
+				<scope>test</scope>
+			</dependency>
 			<!-- declare Spring BOMs in order -->
 			<dependency>
-				<groupId>io.spring.platform</groupId>
-				<artifactId>platform-bom</artifactId>
-				<version>${platform-bom.version}</version>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-dependencies</artifactId>
+				<version>${spring-boot.version}</version>
 				<type>pom</type>
 				<scope>import</scope>
 			</dependency>
@@ -317,6 +327,12 @@
 				<type>pom</type>
 				<scope>import</scope>
 			</dependency>
+			<!-- required by eureka -->
+			<dependency>
+				<groupId>com.sun.jersey.contribs</groupId>
+				<artifactId>jersey-apache-client4</artifactId>
+				<version>1.19.4</version>
+			</dependency>
 			<!-- ctrip modified -->
 			<!-- removed duplicated javax/persistence classes -->
 			<dependency>
@@ -383,6 +399,18 @@
 			<artifactId>awaitility</artifactId>
 			<scope>test</scope>
 		</dependency>
+		<!-- for junit 4 -->
+		<dependency>
+			<groupId>org.junit.vintage</groupId>
+			<artifactId>junit-vintage-engine</artifactId>
+			<scope>test</scope>
+			<exclusions>
+				<exclusion>
+					<groupId>org.hamcrest</groupId>
+					<artifactId>hamcrest-core</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 1 - 1
scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh

@@ -16,7 +16,7 @@ SERVER_URL="http://${APOLLO_ADMIN_SERVICE_NAME}:${SERVER_PORT}"
 
 ########### The following is the same for configservice, adminservice, portal ###########
 export JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+DisableExplicitGC -XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 
 # Find Java
 if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then

+ 1 - 1
scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh

@@ -15,7 +15,7 @@ SERVER_URL="http://${APOLLO_CONFIG_SERVICE_NAME}:${SERVER_PORT}"
 
 ########### The following is the same for configservice, adminservice, portal ###########
 export JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+DisableExplicitGC -XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 
 # Find Java
 if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then

+ 1 - 1
scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh

@@ -16,7 +16,7 @@ SERVER_URL="http://${APOLLO_PORTAL_SERVICE_NAME}:${SERVER_PORT}"
 
 ########### The following is the same for configservice, adminservice, portal ###########
 export JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+DisableExplicitGC -XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 
 # Find Java
 if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then