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