refactor: 错误日志输出到日志文件
This commit is contained in:
parent
123a88b578
commit
327d307ed2
|
@ -17,10 +17,7 @@ import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
|||
import io.metersphere.base.domain.ApiTest;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.utils.CronUtils;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.controller.request.BaseQueryRequest;
|
||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||
import io.metersphere.controller.request.ScheduleRequest;
|
||||
|
@ -288,7 +285,7 @@ public class APITestController {
|
|||
returnStr = df.format(coverageRageNumber) + "%";
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return returnStr;
|
||||
}
|
||||
|
@ -308,7 +305,7 @@ public class APITestController {
|
|||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
returnStr = df.format(intetfaceCoverageRageNumber) + "%";
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return returnStr;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import io.metersphere.api.service.ApiDefinitionService;
|
|||
import io.metersphere.api.service.ShareInfoService;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ShareInfo;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -68,7 +69,7 @@ public class ShareInfoController {
|
|||
try{
|
||||
returnDTO = shareInfoService.conversionModelToDTO(apiModel);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
returnDTO.setSelectedFlag(true);
|
||||
return returnDTO;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -123,7 +124,7 @@ public class EsbDataStruct {
|
|||
element.addAttribute("attr", attrString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
if (element != null) {
|
||||
|
@ -162,7 +163,7 @@ public class EsbDataStruct {
|
|||
element.addAttribute("attr", attrString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
if (element != null) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -123,7 +124,7 @@ public class TcpTreeTableDataStruct {
|
|||
element.addAttribute("attr", attrString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
if (element != null) {
|
||||
|
@ -162,7 +163,7 @@ public class TcpTreeTableDataStruct {
|
|||
element.addAttribute("attr", attrString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
if (element != null) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.api.dto.automation.parse;
|
|||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.metersphere.api.dto.automation.EsbDataStruct;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
|
@ -55,11 +56,11 @@ public class EsbDataParser {
|
|||
xmlString = stringWriter.toString();
|
||||
xmlWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
if (StringUtils.isEmpty(xmlString)) {
|
||||
xmlString = "";
|
||||
|
|
|
@ -106,7 +106,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
scenarioImport.setProjectId(request.getProjectId());
|
||||
return scenarioImport;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
MSException.throwException("当前JMX版本不兼容");
|
||||
}
|
||||
return null;
|
||||
|
@ -315,7 +315,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
body.getBinary().add(new KeyValue());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
SaveService.saveElement(obj, baos);
|
||||
return baos.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
LogUtil.warn("HashTree error, can't log jmx scenarioDefinition");
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.api.dto.automation.parse;
|
||||
|
||||
import io.metersphere.api.dto.automation.TcpTreeTableDataStruct;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
|
@ -62,11 +63,11 @@ public class TcpTreeTableDataParser {
|
|||
xmlString = stringWriter.toString();
|
||||
xmlWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
if (StringUtils.isEmpty(xmlString)) {
|
||||
xmlString = "";
|
||||
|
|
|
@ -16,6 +16,7 @@ import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
|||
import io.metersphere.base.domain.ApiModule;
|
||||
import io.metersphere.base.domain.EsbApiParamsWithBLOBs;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.swagger.models.Model;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -63,7 +64,7 @@ public class ESBParser extends EsbAbstractParser {
|
|||
wb.write(out);
|
||||
wb.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
|
@ -524,7 +525,7 @@ public class ESBParser extends EsbAbstractParser {
|
|||
} catch (IllegalStateException e2) {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -16,6 +16,7 @@ import io.metersphere.api.dto.definition.request.extract.MsExtractRegex;
|
|||
import io.metersphere.api.dto.definition.request.extract.MsExtractXPath;
|
||||
import io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor;
|
||||
import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsDubboSampler;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
|
||||
|
@ -116,7 +117,7 @@ public class JmeterDefinitionParser extends ApiImportAbstractParser<ApiDefinitio
|
|||
apiImport.setCases(definitionCases);
|
||||
return apiImport;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
MSException.throwException("当前JMX版本不兼容");
|
||||
}
|
||||
return null;
|
||||
|
@ -703,7 +704,7 @@ public class JmeterDefinitionParser extends ApiImportAbstractParser<ApiDefinitio
|
|||
body.getBinary().add(new KeyValue());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.api.dto.definition.request.auth;
|
|||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import lombok.Data;
|
||||
|
@ -95,7 +96,7 @@ public class MsAuthManager extends MsTestElement {
|
|||
authManager.addAuth(auth);
|
||||
tree.add(authManager);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public class MockApiUtils {
|
|||
returnObj.put(key, values);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
return returnObj;
|
||||
|
@ -480,7 +480,7 @@ public class MockApiUtils {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return returnJson;
|
||||
} else if (StringUtils.startsWithIgnoreCase(request.getContentType(),"text/xml")) {
|
||||
|
@ -560,7 +560,7 @@ public class MockApiUtils {
|
|||
inputStream.close();
|
||||
result = new String(outSteam.toByteArray(), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ public class MsKafkaListener {
|
|||
return element;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -105,7 +105,7 @@ public class MsResultCollector extends AbstractListenerElement implements Sample
|
|||
client.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ public class MsResultCollector extends AbstractListenerElement implements Sample
|
|||
client = new MsWebSocketClient("ws://127.0.0.1:8081/ws/" + "send." + this.getName());
|
||||
client.connect();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -516,7 +516,7 @@ public class APITestService {
|
|||
}
|
||||
jmxString = root.asXML();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
if (!jmxString.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")) {
|
||||
|
@ -538,7 +538,7 @@ public class APITestService {
|
|||
fileMetadataList.add(fileMetadata);
|
||||
attachmentFiles.put(fileMetadata.getId(),fileMetadata.getName());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -953,7 +953,7 @@ public class ApiAutomationService {
|
|||
}
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1040,7 +1040,7 @@ public class ApiAutomationService {
|
|||
scenario.setVariables(variables);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -2625,7 +2625,7 @@ public class ApiAutomationService {
|
|||
urlList = new ArrayList<>(unionList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return urlList;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.base.domain.ApiScenarioReferenceId;
|
|||
import io.metersphere.base.domain.ApiScenarioReferenceIdExample;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.base.mapper.ApiScenarioReferenceIdMapper;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
|
@ -91,7 +92,7 @@ public class ApiScenarioReferenceIdService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
if(MapUtils.isNotEmpty(refreceIdDic)){
|
||||
for (ApiScenarioReferenceId model:refreceIdDic.values()) {
|
||||
|
@ -106,7 +107,7 @@ public class ApiScenarioReferenceIdService {
|
|||
try{
|
||||
apiScenarioReferenceIdMapper.insert(saveItem);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -707,7 +707,6 @@ public class ApiTestCaseService {
|
|||
req.setPath(path);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
String requestStr = JSON.toJSONString(req);
|
||||
|
|
|
@ -13,6 +13,7 @@ import io.metersphere.base.mapper.ApiTestEnvironmentMapper;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.FileUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.EnvironmentRequest;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
|
@ -238,7 +239,7 @@ public class ApiTestEnvironmentService {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
needUpdate = true;
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
if (needUpdate) {
|
||||
|
@ -431,7 +432,7 @@ public class ApiTestEnvironmentService {
|
|||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
return returnStr;
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.api.dto.automation.EsbDataStruct;
|
|||
import io.metersphere.api.dto.automation.SaveApiScenarioRequest;
|
||||
import io.metersphere.api.dto.automation.parse.EsbDataParser;
|
||||
import io.metersphere.api.dto.definition.*;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.MsTestPlan;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler;
|
||||
|
@ -220,7 +221,7 @@ public class EsbApiParamService {
|
|||
//更新EsbApiParams类
|
||||
// EsbApiParamsWithBLOBs esbApiParams = this.createEsbApiParam(request.getId(), request.getEsbDataStruct(), request.getBackEsbDataStruct(), request.getBackScript());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
@ -239,7 +240,7 @@ public class EsbApiParamService {
|
|||
//更新EsbApiParams类
|
||||
EsbApiParamsWithBLOBs esbApiParams = this.createEsbApiParam(request.getId(), request.getEsbDataStruct(), request.getBackEsbDataStruct(), request.getBackScript());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
@ -276,7 +277,7 @@ public class EsbApiParamService {
|
|||
// //更新EsbApiParams类
|
||||
// EsbApiParamsWithBLOBs esbApiParams = this.createEsbApiParam(request.getId(), request.getEsbDataStruct(), request.getBackEsbDataStruct(), request.getBackScript());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// LogUtil.error(e);
|
||||
// }
|
||||
// return request;
|
||||
// }
|
||||
|
@ -307,7 +308,7 @@ public class EsbApiParamService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return keyValueList;
|
||||
}
|
||||
|
@ -336,7 +337,7 @@ public class EsbApiParamService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return keyValueList;
|
||||
}
|
||||
|
@ -364,7 +365,7 @@ public class EsbApiParamService {
|
|||
//更新EsbApiParams类
|
||||
EsbApiParamsWithBLOBs esbApiParams = this.createEsbApiParam(request.getId(), request.getEsbDataStruct(), request.getBackEsbDataStruct(), request.getBackEsbDataStruct());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
@ -377,7 +378,7 @@ public class EsbApiParamService {
|
|||
tcpSampler.setParameters(keyValueList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,7 +423,7 @@ public class EsbApiParamService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import io.metersphere.api.dto.SaveHistoricalDataUpgrade;
|
|||
import io.metersphere.api.dto.automation.ScenarioStatus;
|
||||
import io.metersphere.api.dto.datacount.ApiMethodUrlDTO;
|
||||
import io.metersphere.api.dto.definition.request.MsScenario;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.assertions.MsAssertionDuration;
|
||||
import io.metersphere.api.dto.definition.request.assertions.MsAssertions;
|
||||
|
@ -320,7 +321,7 @@ public class HistoricalDataUpgradeService {
|
|||
FileChannel outChannel = new FileOutputStream(new File(newPath)).getChannel();) {
|
||||
inChannel.transferTo(0, inChannel.size(), outChannel);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ public class MockConfigService {
|
|||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
return returnModel;
|
||||
|
@ -725,7 +725,7 @@ public class MockConfigService {
|
|||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
return returnModel;
|
||||
|
@ -804,7 +804,7 @@ public class MockConfigService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return returnStr;
|
||||
}
|
||||
|
@ -937,7 +937,7 @@ public class MockConfigService {
|
|||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return returnStr;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import io.metersphere.commons.exception.MSException;
|
|||
import io.metersphere.commons.json.JSONSchemaGenerator;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||
import io.metersphere.track.service.TestPlanScenarioCaseService;
|
||||
|
@ -73,7 +74,7 @@ public class ShareInfoService {
|
|||
shareApiIdList.add(apiId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
return shareApiIdList;
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.api.service;
|
|||
import io.metersphere.api.dto.automation.TcpTreeTableDataStruct;
|
||||
import io.metersphere.api.dto.automation.parse.TcpTreeTableDataParser;
|
||||
import io.metersphere.api.dto.definition.SaveApiDefinitionRequest;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -49,7 +50,7 @@ public class TcpApiParamService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return tcpSampler;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,6 @@ public class TestResultService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.api.tcp;
|
|||
|
||||
import io.metersphere.api.tcp.server.TCPServer;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -34,7 +35,7 @@ public class TCPPool {
|
|||
returnString = "OK";
|
||||
}catch (Exception e){
|
||||
returnString = e.getMessage();
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +82,7 @@ public class TCPPool {
|
|||
returnMsg = "OK";
|
||||
}catch (Exception e){
|
||||
returnMsg = e.getMessage();
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return returnMsg;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package io.metersphere.api.tcp.server;
|
||||
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
|
@ -55,7 +57,7 @@ public class TCPServer implements Runnable {
|
|||
try {
|
||||
this.openSocket();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.api.dto.mock.MockApiUtils;
|
|||
import io.metersphere.api.service.MockConfigService;
|
||||
import io.metersphere.base.domain.MockExpectConfigWithBLOBs;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -32,7 +33,7 @@ public class TCPServicer {
|
|||
returnMsg = this.getReturnMsg(message);
|
||||
os.write(returnMsg.getBytes());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}finally {
|
||||
this.close();
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ public class TCPServicer {
|
|||
delayed = responseObj.getInteger("delayed");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
if(responseObj.containsKey("responseResult")){
|
||||
JSONObject respResultObj = responseObj.getJSONObject("responseResult");
|
||||
|
@ -63,7 +64,7 @@ public class TCPServicer {
|
|||
delayed = respResultObj.getInteger("delayed");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}else {
|
||||
returnMsg = responseObj.getString("body");
|
||||
|
@ -73,7 +74,7 @@ public class TCPServicer {
|
|||
try {
|
||||
Thread.sleep(delayed);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
return returnMsg;
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.commons.json;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.*;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.jmeter.utils.ScriptEngineUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
@ -22,7 +23,7 @@ public class JSONSchemaGenerator {
|
|||
JsonObject rootElement = element.getAsJsonObject();
|
||||
analyzeRootSchemaElement(rootElement, rootObj);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public class CompressUtils {
|
|||
file.delete();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class DateUtils {
|
|||
returnMap.put("firstTime", thisWeekFirstTime);
|
||||
returnMap.put("lastTime", thisWeekLastTime);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return returnMap;
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ public class FileUtils {
|
|||
jarFiles.add(byteArrayResource);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
return jarFiles;
|
||||
|
|
|
@ -50,7 +50,7 @@ public class JsonStructUtils {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return lastMatchResultIsTrue && !hasNotMatchResult;
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ public class JsonStructUtils {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
@ -99,7 +99,7 @@ public class JsonStructUtils {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
|
@ -143,7 +143,7 @@ public class JsonStructUtils {
|
|||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return isMatch;
|
||||
} else {
|
||||
|
|
|
@ -113,7 +113,7 @@ public class RsaUtil {
|
|||
try {
|
||||
key = (RSAPublicKey) keyFactory.generatePublic(x509KeySpec);
|
||||
} catch (InvalidKeySpecException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class RsaUtil {
|
|||
try {
|
||||
key = (RSAPrivateKey) keyFactory.generatePrivate(pkcs8KeySpec);
|
||||
} catch (InvalidKeySpecException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public class UrlTestUtils {
|
|||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -148,7 +148,7 @@ public class WeakConcurrentHashMap<K, V> extends ConcurrentHashMap<K, V> {
|
|||
try {
|
||||
Thread.sleep(expiryInMillis / 2);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public abstract class EasyExcelListener<T> extends AnalysisEventListener<T> {
|
|||
}
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
super.invokeHeadMap(headMap, context);
|
||||
|
|
|
@ -125,7 +125,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
// }
|
||||
// }
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
// }
|
||||
this.formatHeadMap();
|
||||
|
|
|
@ -310,7 +310,7 @@ public class ScheduleManager {
|
|||
returnMap.put("groupName", groupName);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
|
||||
return returnMap;
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
|
|||
import io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler;
|
||||
import io.metersphere.api.dto.scenario.Body;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.log.utils.diff.json.JacksonDiff;
|
||||
import io.metersphere.log.utils.diff.json.JsonDiff;
|
||||
import io.metersphere.log.vo.DetailColumn;
|
||||
|
@ -71,7 +72,7 @@ public class ApiDefinitionDiffUtil {
|
|||
return JSON.toJSONString(diffMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -2,14 +2,13 @@ package io.metersphere.notice.util;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.http.HttpStatus;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -42,12 +41,12 @@ public class LarkClient {
|
|||
sendResult.setIsSuccess(errcode.equals(0));
|
||||
}*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
return sendResult;
|
||||
|
|
|
@ -136,7 +136,7 @@ public class MetricQueryService {
|
|||
timestamps.add(DateUtils.getTimeString((long) (timestamp * 1000)));
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
values.add(ja.getDouble(1));
|
||||
});
|
||||
|
|
|
@ -811,7 +811,7 @@ public class PerformanceTestService {
|
|||
try {
|
||||
fileMetadata = fileService.saveFile(file, FileUtil.readAsByteArray(file));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
saveLoadTestFile(fileMetadata, loadTestId, sort);
|
||||
}
|
||||
|
|
|
@ -11,10 +11,7 @@ import io.metersphere.commons.constants.UserGroupConstants;
|
|||
import io.metersphere.commons.constants.UserGroupType;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.controller.request.GroupRequest;
|
||||
import io.metersphere.controller.request.group.EditGroupRequest;
|
||||
import io.metersphere.controller.request.group.EditGroupUserRequest;
|
||||
|
@ -170,7 +167,7 @@ public class GroupService {
|
|||
List<GroupResourceDTO> dtoPermissions = dto.getPermissions();
|
||||
dtoPermissions.addAll(getResourcePermission(resource, permissions, type, permissionList));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
return dto;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.track.dto.TreeNodeDTO;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -22,9 +23,9 @@ public class NodeTreeService<T extends TreeNodeDTO> {
|
|||
try {
|
||||
instance = (T) clazz.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public class PluginService {
|
|||
|
||||
method.invoke(classLoader, url);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.base.mapper.ext.ExtUserMapper;
|
|||
import io.metersphere.commons.constants.UserGroupConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.ProjectRequest;
|
||||
|
@ -685,7 +686,7 @@ public class ProjectService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,6 @@ public class ScheduleService {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("初始化任务失败", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1723,8 +1723,7 @@ public class TestCaseService {
|
|||
isUpdated = easyExcelListener.isUpdated();
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -342,7 +342,6 @@ public class TestPlanApiCaseService {
|
|||
return jDBCSampler;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -1076,7 +1076,7 @@ public class TestPlanService {
|
|||
runModeConfig = JSONObject.parseObject(apiRunConfig, RunModeConfig.class);
|
||||
runModeConfig.setOnSampleError(false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
if (runModeConfig == null) {
|
||||
runModeConfig = new RunModeConfig();
|
||||
|
@ -1157,7 +1157,7 @@ public class TestPlanService {
|
|||
testPlanLoadCaseService.update(loadCase);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
performaneThreadIDMap.put(performanceRequest.getTestPlanLoadId(),reportId);
|
||||
if (StringUtils.isNotEmpty(reportId)) {
|
||||
|
@ -1200,7 +1200,7 @@ public class TestPlanService {
|
|||
Thread.sleep(10000);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.websocket.c.to.c;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.websocket.c.to.c.util.MsgDto;
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
|
@ -48,7 +49,7 @@ public class MsWebSocketClient extends WebSocketClient{
|
|||
dto.setToReport("3933abd9");
|
||||
client.send(JSON.toJSONString(dto));
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4cbe39abad949c27aee0bf222da0d175550f2bcf
|
||||
Subproject commit 14c626b6a1a78532960ba0eb64eaa9d8d3869aed
|
|
@ -288,8 +288,7 @@ public abstract class JSR223TestElement extends ScriptingTestElement
|
|||
}
|
||||
groovyScriptEngine.getClassLoader().addURL(file.toURI().toURL());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
LogUtil.error(e);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue