这个接口可以来控制项目引入的日志注解是否生效(即是否打印日志)
/**
* 设置是否记录日志
* http://xxxxxxxxxxxx:8081/xxxxx/appi/busi/log/isWriteLog/true?sign=2d0e3c349dbf29470c1b89dfd895e2ae×tamp=1539320912
* @param isWriteLog
* @return
*/
@RequestMapping(value = "/isWriteLog/{isWriteLog}",method = RequestMethod.POST)
@ResponseBody
public Object isWriteLog(@PathVariable("isWriteLog") String isWriteLog) {
if(StringUtils.equalsIgnoreCase("true",isWriteLog)){
ApiLogAspect.isWriteLog = true;
}else if(StringUtils.equalsIgnoreCase("false",isWriteLog)){
ApiLogAspect.isWriteLog = false;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("isWriteLog",ApiLogAspect.isWriteLog);
try {
InetAddress addr = InetAddress.getLocalHost();
String ip = addr.getHostAddress().toString(); //获取本机ip
String hostName = addr.getHostName().toString(); //获取本机计算机名称
jsonObject.put("ip",ip);
jsonObject.put("hostName",hostName);
} catch (UnknownHostException e) {
logger.error("isWriteLog:{}",e);
}
return ResultUtil.getSuccessResJson(jsonObject);
}