rev 去除loki

This commit is contained in:
USER-20220102CG\noblelift
2024-02-02 16:32:30 +08:00
parent 709d15f977
commit e2cfc536bb
11 changed files with 32 additions and 154 deletions

View File

@@ -20,8 +20,6 @@ import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDr
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.device.enums.DeviceType;
@@ -36,8 +34,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.nl.acs.device_driver.conveyor.double_station_stacker.enums.CommandEnum.PICKUP_COMPLETE;
/**
* @author 20220102CG\noblelift
*/
@@ -115,7 +111,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse sendAgvInstToMagic(String instcode) throws Exception {
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
@@ -124,7 +120,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
return result;
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse queryAgvInstStatus(String instCode) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -145,7 +141,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse sendAgvInstToMagic(Instruction inst) throws Exception {
@@ -367,7 +363,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
return destinationOrder;
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse queryMagicAgvDeviceStatus() {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -415,7 +411,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse deleteAgvInst(String instCode) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -451,7 +447,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
* @param processingVehicle
* @return
*/
@LokiLog(type = LokiLogType.AGV)
@Override
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle) {
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action);
@@ -613,7 +609,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public String requestAck(String address) {
log.info("AGV请求离开参数:{}", address);
@@ -689,7 +685,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse pause() throws Exception {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -717,7 +713,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse pause(String device_code) throws Exception {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -741,7 +737,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse resume() throws Exception {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -770,7 +766,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse resume(String device_code) throws Exception {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -792,7 +788,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
}
}
@LokiLog(type = LokiLogType.AGV)
@Override
public String queryDoorStatus(String device) {
log.info("AGV查询自动门状态,参数:{}", device);

View File

@@ -12,8 +12,6 @@ import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
@@ -41,7 +39,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
Map<String, AgvDto> AGVDeviceStatus = new HashMap();
@LokiLog(type = LokiLogType.AGV)
@Override
public void deleteAgvInstToNDC(Instruction inst) throws Exception {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -74,7 +72,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -309,7 +307,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public Map<String, AgvDto> findAllAgvFromCache() {
return AGVDeviceStatus;

View File

@@ -21,8 +21,6 @@ import org.nl.acs.device.domain.Device;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.device.enums.DeviceType;
import org.nl.common.exception.BadRequestException;
@@ -67,7 +65,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
@Value("${agvToAcs.addr}")
private String addr;
@LokiLog(type = LokiLogType.AGV)
@Override
public String waitPointRequest(String param) {
log.info("收到AGV请求参数:{}", param);
@@ -112,7 +110,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse markComplete(String code) throws Exception {
@@ -138,7 +136,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse queryXZAgvDeviceStatus() {
@@ -199,7 +197,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse queryXZAgvInstStatus(String instCode) {
@@ -222,7 +220,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse deleteXZAgvInst(String instCode) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -242,7 +240,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception {
com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
@@ -444,7 +442,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse addOrderSequences(Instruction inst) throws Exception {
JSONObject orderjo = createOrederData(inst, CommonFinalParam.ONE);
@@ -471,7 +469,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
@LokiLog(type = LokiLogType.AGV)
@Override
public String sendOrderSequencesParam(Instruction inst) throws Exception {
JSONObject jo = new JSONObject();
@@ -489,7 +487,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
return jo.toString();
}
@LokiLog(type = LokiLogType.AGV)
@Override
public JSONObject createOrederData(Instruction inst, String inst_type) {
String inst_code = inst.getInstruction_code();
@@ -626,7 +624,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
return destinationOrder;
}
@LokiLog(type = LokiLogType.AGV)
@Override
public String queryDoorStatus(String device) {
log.info("AGV查询自动门状态,参数:{}", device);

View File

@@ -17,8 +17,6 @@ import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorD
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.task.service.TaskService;
@@ -61,7 +59,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
*/
private static final String UNLOAD = "Unload";
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse sendAgvInstToAgv(Instruction inst) throws Exception {
JSONObject jo = new JSONObject();
@@ -127,7 +125,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
* @param type
* @return
*/
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse queryAgvInstStatus(String type) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
@@ -165,7 +163,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
* @param processingVehicle
* @return
*/
@LokiLog(type = LokiLogType.AGV)
@Override
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle) {
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action);
@@ -341,7 +339,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
}
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse markComplete(String code) {
@@ -378,7 +376,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
* demo:destination("cz14", "JackUnload", "3", "")
* @return
*/
@LokiLog(type = LokiLogType.AGV)
public static JSONObject destination(String locationName, String operation, String propertiesType, String pro) {
//新增业务订单
JSONObject destinationOrder = new JSONObject();

View File

@@ -22,8 +22,6 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
@@ -34,8 +32,6 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import java.util.Arrays;
/**
* NDC双工位AGV
@@ -65,7 +61,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
private Instruction instruction;
String message = null;
@LokiLog(type = LokiLogType.ACS_TO_LMS)
public synchronized void processSocket(int[] arr) throws Exception {
device_code = this.getDeviceCode();
byte[] data = null;

View File

@@ -7,8 +7,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.common.exception.BadRequestException;
import org.nl.config.language.LangProcess;
@@ -23,7 +21,7 @@ import org.nl.system.service.param.impl.SysParamServiceImpl;
public class AcsUtil {
@LokiLog(type = LokiLogType.ACS_TO_LK)
public static <W> String notifyAcs(String api, W requestParam) {
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
;
@@ -35,7 +33,6 @@ public class AcsUtil {
}
String liKu_wcs_url = paramService.findByCode("liKu_wcs_url").getValue();
try {
logServer.extLog(LokiLogType.ACS_TO_LK.name(), "下发立库任务请求参数:{}" + JSON.toJSONString(requestParam));
log.info("下发立库任务请求参数:{}", JSON.toJSONString(requestParam));
String body = HttpRequest
.post(liKu_wcs_url + api).setConnectionTimeout(3000)

View File

@@ -1,15 +0,0 @@
package org.nl.acs.log;
import java.lang.annotation.*;
/**
* @author: lyd
* @description: 自定义日志注解, 用作LOKI日志分类
* @Date: 2022/10/10
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
public @interface LokiLog {
LokiLogType type() default LokiLogType.DEFAULT;
}

View File

@@ -1,59 +0,0 @@
package org.nl.acs.log;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
/**
* @author: lyd
* @description: 自定义日志切面:https://cloud.tencent.com/developer/article/1655923
* @Date: 2022/10/10
*/
@Aspect
@Slf4j
@Component
public class LokiLogAspect {
/**
* 切到所有OperatorLog注解修饰的方法
*/
@Pointcut("@annotation(org.nl.acs.log.LokiLog)")
public void operatorLog() {
// 空方法
}
/**
* 利用@Around环绕增强
*
* @return
*/
@Around("operatorLog()")
public Object around(ProceedingJoinPoint pjp) throws Throwable {
Signature signature = pjp.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
LokiLog lokiLog = method.getAnnotation(LokiLog.class);
// 获取描述信息
LokiLogType logType = lokiLog.type();
MDC.put("log_file_type", logType.getDesc());
log.info("输入参数:" + JSONObject.toJSONString(pjp.getArgs()));
Object proceed = pjp.proceed();
log.info("返回参数:" + JSONObject.toJSONString(proceed));
MDC.remove("log_file_type");
return proceed;
}
}

View File

@@ -1,27 +0,0 @@
package org.nl.acs.log;
/**
* @author: lyd
* @description:
* @Date: 2022/10/11
*/
public enum LokiLogType {
// 默认
DEFAULT("默认"),
// AGV接口日志
AGV("AGV接口日志"),
// ACS请求LMS
ACS_TO_LMS("ACS请求LMS"),
// ACS请求立库
ACS_TO_LK("ACS请求立库");
private String desc;
LokiLogType(String desc) {
this.desc = desc;
}
public String getDesc() {
return desc;
}
}

View File

@@ -79,7 +79,7 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
//向document对象中添加域。
Map<String, String> mdcPropertyMap = event.getMDCPropertyMap();
String traceId = mdcPropertyMap.get("traceId");
System.out.println("---追踪号---"+traceId);
// System.out.println("---追踪号---"+traceId);
if (ObjectUtil.isNotEmpty(traceId)) {
document.add(new StringField("trace_id", traceId, Field.Store.YES));
}

View File

@@ -14,9 +14,6 @@ https://juejin.cn/post/6844903775631572999
<property name="log.pattern"
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<!-- <springProperty scope="context" name="lokiUrl" source="loki.url"/>-->
<springProperty scope="context" name="systemName" source="loki.systemName"/>
<!-- <property name="LOKI_URL" value="${lokiUrl}"/>-->
<property name="SYSTEM_NAME" value="${systemName}"/>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="${logPath}"/>