Browse Source

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

dev_shibei_match
jianjun 5 years ago
parent
commit
e9e736b72b
  1. 10
      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

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java

@ -93,13 +93,18 @@ public class LogMsgSendFilter extends LevelFilter {
/** /**
* desc:获取服务 ip及profile信息 * desc:获取服务 ip及profile信息
*
*/ */
private void getServerInfo() { private void getServerInfo() {
try {
if (serverIp == null) { if (serverIp == null) {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
} }
} catch (Exception e) {
logger.warn("getServerInfo get bean InetUtils exception", e);
return;
}
try {
if (activeEnv == null) { if (activeEnv == null) {
Environment environment = SpringContextUtils.getBean(Environment.class); Environment environment = SpringContextUtils.getBean(Environment.class);
String[] activeProfiles = environment.getActiveProfiles(); String[] activeProfiles = environment.getActiveProfiles();
@ -108,6 +113,9 @@ public class LogMsgSendFilter extends LevelFilter {
activeEnv = activeProfiles[0]; activeEnv = activeProfiles[0];
} }
} }
} catch (Exception e) {
logger.warn("getServerInfo get bean Environment exception", e);
}
} }
private void apendStackInfo(StringBuilder stringBuilder, IThrowableProxy throwableProxy) { private void apendStackInfo(StringBuilder stringBuilder, IThrowableProxy throwableProxy) {

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml

@ -10,7 +10,7 @@ spring:
name: data-statistical-server name: data-statistical-server
#环境 dev|test|prod #环境 dev|test|prod
profiles: profiles:
active: dev active: @spring.profiles.active@
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss 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 name: epmet-heart-server
#环境 dev|test|prod #环境 dev|test|prod
profiles: profiles:
active: dev active: @spring.profiles.active@
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss 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 name: epmet-job-server
#环境 dev|test|prod #环境 dev|test|prod
profiles: profiles:
active: dev active: @spring.profiles.active@
messages: messages:
encoding: UTF-8 encoding: UTF-8
basename: i18n/messages,i18n/messages_common 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 name: epmet-point-server
#环境 dev|test|prod #环境 dev|test|prod
profiles: profiles:
active: dev active: @spring.profiles.active@
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss

Loading…
Cancel
Save