wangwei 6 yıl önce
ebeveyn
işleme
9cd316cdb8

+ 16 - 2
examcloud-exchange-outer-service/src/main/java/cn/com/qmth/examcloud/exchange/outer/service/impl/FaceServiceImpl.java

@@ -53,6 +53,12 @@ public class FaceServiceImpl implements FaceService {
 
 	protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
 
+	/**
+	 * 接口日志
+	 */
+	private static final ExamCloudLog INTERFACE_LOG = ExamCloudLogFactory
+			.getLog("INTERFACE_LOGGER");
+
 	@Autowired
 	StudentCloudService studentCloudService;
 
@@ -135,13 +141,17 @@ public class FaceServiceImpl implements FaceService {
 						.setParameter("faceset_token", facesetToken)
 						.setParameter("face_tokens", faceToken).build();
 
+				INTERFACE_LOG.info("[Face++ Rquest]. url=" + uri.toString());
+
 				HttpPost httpPost = new HttpPost(uri);
 
 				httpResponse = httpClient.execute(httpPost);
 				HttpEntity entity = httpResponse.getEntity();
 				int statusCode = httpResponse.getStatusLine().getStatusCode();
 				String respBody = EntityUtils.toString(entity, "UTF-8");
-				log.info("responseBody=" + respBody);
+
+				INTERFACE_LOG.info(
+						"[Face++ Response]. statusCode=" + statusCode + "; respBody=" + respBody);
 
 				if (respBody.contains("QUOTA_EXCEEDED")) {
 					throw new StatusException("EX-620006", "faceset is full");
@@ -221,13 +231,17 @@ public class FaceServiceImpl implements FaceService {
 						.setParameter("api_secret", apiSecret).setParameter("image_url", photoUrl)
 						.build();
 
+				INTERFACE_LOG.info("[Face++ Rquest]. url=" + uri.toString());
+
 				HttpPost httpPost = new HttpPost(uri);
 
 				httpResponse = httpClient.execute(httpPost);
 				HttpEntity entity = httpResponse.getEntity();
 				int statusCode = httpResponse.getStatusLine().getStatusCode();
 				String respBody = EntityUtils.toString(entity, "UTF-8");
-				log.info("responseBody=" + respBody);
+
+				INTERFACE_LOG.info(
+						"[Face++ Response]. statusCode=" + statusCode + "; respBody=" + respBody);
 
 				if (statusCode == HttpStatus.SC_OK) {
 					JSONObject jsonObject = JSON.parseObject(respBody);