diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java index 4745de9afa..fc5702f97a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java @@ -93,20 +93,28 @@ public class LogMsgSendFilter extends LevelFilter { /** * desc:获取服务 ip及profile信息 - * */ private void getServerInfo() { - if (serverIp == null) { - InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); - serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + try { + if (serverIp == null) { + InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); + serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + } + } catch (Exception e) { + logger.warn("getServerInfo get bean InetUtils exception", e); + return; } - if (activeEnv == null) { - Environment environment = SpringContextUtils.getBean(Environment.class); - String[] activeProfiles = environment.getActiveProfiles(); - if (activeProfiles != null && activeProfiles.length > 0) { - logger.info("activeProfiles:{}", activeProfiles); - activeEnv = activeProfiles[0]; + try { + if (activeEnv == null) { + Environment environment = SpringContextUtils.getBean(Environment.class); + String[] activeProfiles = environment.getActiveProfiles(); + if (activeProfiles != null && activeProfiles.length > 0) { + logger.info("activeProfiles:{}", activeProfiles); + activeEnv = activeProfiles[0]; + } } + } catch (Exception e) { + logger.warn("getServerInfo get bean Environment exception", e); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index c2ed87bf1e..f148ea791b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: data-statistical-server #环境 dev|test|prod profiles: - active: dev + active: @spring.profiles.active@ jackson: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml index c6e70a0bc3..fe8a9ba0d4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: epmet-heart-server #环境 dev|test|prod profiles: - active: dev + active: @spring.profiles.active@ jackson: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml index b8faf3661a..72cbbdaaf8 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: epmet-job-server #环境 dev|test|prod profiles: - active: dev + active: @spring.profiles.active@ messages: encoding: UTF-8 basename: i18n/messages,i18n/messages_common diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml index bf7eb31f91..0f4b3289d7 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: epmet-point-server #环境 dev|test|prod profiles: - active: dev + active: @spring.profiles.active@ jackson: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss