Browse Source

修改环境变量的获取及钉钉消息异常处理

dev_shibei_match
jianjun 5 years ago
parent
commit
e9e736b72b
  1. 28
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml
  3. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml
  4. 2
      epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml
  5. 2
      epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml

28
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);
}
}

2
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

2
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

2
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

2
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

Loading…
Cancel
Save