diff --git a/config/application-dispose.properties b/config/application-dispose.properties
index eed53e73..b1de7e12 100644
--- a/config/application-dispose.properties
+++ b/config/application-dispose.properties
@@ -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
diff --git a/config/logback.xml b/config/logback.xml
index e2366d06..b55cb21a 100644
--- a/config/logback.xml
+++ b/config/logback.xml
@@ -3,6 +3,7 @@
+
@@ -45,10 +46,15 @@
-
+
+
+
+
+
com.dispose
dispose_platform
- 2.0.8.8
+ 2.0.8.9
dispose_platform
Dispose Platform
diff --git a/src/main/java/com/dispose/ability/impl/PengXinAbilityImpl.java b/src/main/java/com/dispose/ability/impl/PengXinAbilityImpl.java
index aa5c4be0..b4c37619 100644
--- a/src/main/java/com/dispose/ability/impl/PengXinAbilityImpl.java
+++ b/src/main/java/com/dispose/ability/impl/PengXinAbilityImpl.java
@@ -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");
}
/**
diff --git a/src/main/java/com/dispose/common/DisposeConfigValue.java b/src/main/java/com/dispose/common/DisposeConfigValue.java
index 3691df59..a00792ca 100644
--- a/src/main/java/com/dispose/common/DisposeConfigValue.java
+++ b/src/main/java/com/dispose/common/DisposeConfigValue.java
@@ -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 LOG_HOSTS = new ArrayList<>();
}
diff --git a/src/main/java/com/dispose/config/DeviceLogConfigure.java b/src/main/java/com/dispose/config/DeviceLogConfigure.java
new file mode 100644
index 00000000..2cd82854
--- /dev/null
+++ b/src/main/java/com/dispose/config/DeviceLogConfigure.java
@@ -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);
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/dispose/restful/RestfulInterface.java b/src/main/java/com/dispose/restful/RestfulInterface.java
index a04d73db..7b20beda 100644
--- a/src/main/java/com/dispose/restful/RestfulInterface.java
+++ b/src/main/java/com/dispose/restful/RestfulInterface.java
@@ -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 ProtocolRespDTO baseProRun(String url, String token, E obj, Class subClass,
RequestMethod reqType) {
String svrResp = null;
+ String reqJson = "";
try {
Map 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>() {
- @Override
- public Type getType() {
- return createRespType(subClass);
- }
- });
+ new TypeReference>() {
+ @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());
}
}
diff --git a/src/main/java/com/pengxin/dispose/protocol/PengXinInterface.java b/src/main/java/com/pengxin/dispose/protocol/PengXinInterface.java
index 39396b83..9057d121 100644
--- a/src/main/java/com/pengxin/dispose/protocol/PengXinInterface.java
+++ b/src/main/java/com/pengxin/dispose/protocol/PengXinInterface.java
@@ -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;