OCT
REM: 1. 增加线上设备调试信息配置项 2. 增加线上设备请求、响应json调试信息 3. 版本更新到 2.0.8.9
This commit is contained in:
parent
50641d2a5f
commit
2ede6d0503
|
@ -49,3 +49,7 @@ trust.auth-white-list-check=true
|
|||
trust.auth-host-token=165B2AA40395fA27278E59eEd4DD5EA490DA175344DE2673A5B17D3760E12F0
|
||||
# 白名单主机,多个主机逗号(,)分割
|
||||
trust.auth-hosts=127.0.0.12,::1
|
||||
|
||||
#需要调试的设备IP/IP+端口
|
||||
# 主机,多个主机逗号(,)分割
|
||||
device.log-hosts=https://111.28.2.17:443,http://172.21.44.239
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
<property name="LOG_PATH" value="./logs"/>
|
||||
<property name="LOG_LEVEL" value="info"/>
|
||||
<property name="SVR_LOG_LEVEL" value="info"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder charset="UTF-8">
|
||||
|
@ -45,10 +46,15 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="com.cmcc.hy.phoenix" level="${LOG_LEVEL}" additivity="false">
|
||||
<logger name="com.dispose" level="${SVR_LOG_LEVEL}" additivity="false">
|
||||
<appender-ref ref="BIZ"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.dispose.mapper" level="${LOG_LEVEL}"
|
||||
additivity="false">
|
||||
<appender-ref ref="DATA"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.cmcc.hy.phoenix.mapper" level="${LOG_LEVEL}"
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -17,7 +17,7 @@
|
|||
</parent>
|
||||
<groupId>com.dispose</groupId>
|
||||
<artifactId>dispose_platform</artifactId>
|
||||
<version>2.0.8.8</version>
|
||||
<version>2.0.8.9</version>
|
||||
<name>dispose_platform</name>
|
||||
<description>Dispose Platform</description>
|
||||
<dependencies>
|
||||
|
|
|
@ -582,8 +582,6 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
*/
|
||||
@Override
|
||||
public void periodTaskRuntime() {
|
||||
log.debug("++++PengXin Period Task Running");
|
||||
|
||||
// 集团一键处置线上环境,不再定时获取设备能力信息
|
||||
// 更新防护对象
|
||||
//getDisposeDeviceProtectObject();
|
||||
|
@ -592,8 +590,6 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
if (timerCnt++ % DisposeConfigValue.HEART_PERIOD_OF_SECOND == 0) {
|
||||
devGetLinkStatus();
|
||||
}
|
||||
|
||||
log.debug("----PengXin Period Task Running");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package com.dispose.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Dispose config value.
|
||||
*
|
||||
|
@ -63,4 +66,9 @@ public class DisposeConfigValue {
|
|||
* The constant HEART_PERIOD_OF_SECOND.
|
||||
*/
|
||||
public static final long HEART_PERIOD_OF_SECOND = 30;
|
||||
|
||||
/**
|
||||
* The constant LOG_HOSTS.
|
||||
*/
|
||||
public static final List<String> LOG_HOSTS = new ArrayList<>();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.dispose.config;
|
||||
|
||||
import com.dispose.common.DisposeConfigValue;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "device")
|
||||
@Configuration
|
||||
public class DeviceLogConfigure {
|
||||
private String[] logHosts;
|
||||
|
||||
@PostConstruct
|
||||
private void initGlobalValue() {
|
||||
for (String s : Optional.ofNullable(logHosts).orElse(new String[]{""})) {
|
||||
if (s.toLowerCase(Locale.ROOT).startsWith("http")) {
|
||||
DisposeConfigValue.LOG_HOSTS.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,16 +29,15 @@ public class RestfulInterface {
|
|||
* The constant OBJECT_MAPPER.
|
||||
*/
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
/**
|
||||
* The constant timeOutValue.
|
||||
*/
|
||||
private static int timeOutValue = new Long(DisposeConfigValue.REQUEST_TIMEOUT_MS).intValue();
|
||||
|
||||
static {
|
||||
OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The constant timeOutValue.
|
||||
*/
|
||||
private static int timeOutValue = new Long(DisposeConfigValue.REQUEST_TIMEOUT_MS).intValue();
|
||||
|
||||
/**
|
||||
* Instantiates a new Restful interface.
|
||||
*/
|
||||
|
@ -197,6 +196,7 @@ public class RestfulInterface {
|
|||
public static <T, E> ProtocolRespDTO<T> baseProRun(String url, String token, E obj, Class<T> subClass,
|
||||
RequestMethod reqType) {
|
||||
String svrResp = null;
|
||||
String reqJson = "";
|
||||
|
||||
try {
|
||||
Map<String, String> httpHeadMap = new HashMap<>(2);
|
||||
|
@ -207,15 +207,12 @@ public class RestfulInterface {
|
|||
httpHeadMap.put(String.valueOf(Header.AUTHORIZATION), ConstValue.STRING_HTTP_AUTH_HEAD + token);
|
||||
}
|
||||
|
||||
String reqJson = OBJECT_MAPPER.writeValueAsString(obj);
|
||||
|
||||
log.debug("Restful request: {}, {}: {}", url, token, reqJson);
|
||||
|
||||
switch (reqType) {
|
||||
case GET:
|
||||
svrResp = getJson(url, httpHeadMap).body();
|
||||
break;
|
||||
case POST:
|
||||
reqJson = OBJECT_MAPPER.writeValueAsString(obj);
|
||||
svrResp = postJson(url, httpHeadMap, reqJson).body();
|
||||
break;
|
||||
default:
|
||||
|
@ -228,17 +225,23 @@ public class RestfulInterface {
|
|||
return null;
|
||||
}
|
||||
|
||||
log.debug("Restful response: {}, {}: {}", url, token, svrResp);
|
||||
if (DisposeConfigValue.LOG_HOSTS.stream().anyMatch(url::startsWith)) {
|
||||
if(reqJson.length() > 0) {
|
||||
log.debug("Restful response: {} {}, {}: \n+++{}\n---{}", reqType.name(), url, token, reqJson, svrResp);
|
||||
} else {
|
||||
log.debug("Restful response: {} {}, {}: \n{}", reqType.name(), url, token, svrResp);
|
||||
}
|
||||
}
|
||||
|
||||
return OBJECT_MAPPER.readValue(svrResp,
|
||||
new TypeReference<ProtocolRespDTO<T>>() {
|
||||
@Override
|
||||
public Type getType() {
|
||||
return createRespType(subClass);
|
||||
}
|
||||
});
|
||||
new TypeReference<ProtocolRespDTO<T>>() {
|
||||
@Override
|
||||
public Type getType() {
|
||||
return createRespType(subClass);
|
||||
}
|
||||
});
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("System exception: \nRequest:{}, {}\nException{}", url, svrResp, e);
|
||||
log.error("System exception: Request:{}, \n+++{}\n---{} Exception {}", url, reqJson, svrResp, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -307,11 +310,11 @@ public class RestfulInterface {
|
|||
*
|
||||
* @param url the url
|
||||
* @param token the token
|
||||
* @param reqBody the obj
|
||||
* @param reqBody the obj
|
||||
* @param reqType the req type
|
||||
* @return the t
|
||||
*/
|
||||
public static HttpResponse huaWeiFireWallProRun(String url, String token, String reqBody, RequestMethod reqType) {
|
||||
public static HttpResponse huaWeiFireWallProRun(String url, String token, String reqBody, RequestMethod reqType) {
|
||||
String body = "";
|
||||
HttpResponse svrResp = null;
|
||||
|
||||
|
@ -370,6 +373,6 @@ public class RestfulInterface {
|
|||
Type[] types = new Type[1];
|
||||
types[0] = c;
|
||||
return ParameterizedTypeImpl.make(ProtocolRespDTO.class, types,
|
||||
ProtocolRespDTO.class.getDeclaringClass());
|
||||
ProtocolRespDTO.class.getDeclaringClass());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class PengXinInterface {
|
|||
}
|
||||
|
||||
try {
|
||||
ErrorCode err = CommonEnumHandler.codeOf(ErrorCode.class, rspInfo.getCode());
|
||||
ErrorCode err = CommonEnumHandler.codeOf(ErrorCode.class, rspInfo.getMsgContent().getStatus());
|
||||
|
||||
if (err == null) {
|
||||
return ErrorCode.ERR_CALLDEVICE;
|
||||
|
|
Loading…
Reference in New Issue