VbLogUtils.java 887 Bytes
package com.example.mina.processor;

import org.slf4j.Logger;
import org.slf4j.MDC;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @ProjectName: demo
 * @Package: com.example.mina.processor
 * @ClassName: VbLogUtils
 * @Author: HuangLang
 * @Description: 用于记录设备日志
 * @Date: 2021-04-01 下午 8:46
 */
public class VbLogUtils {
    public static void infoLog(Logger log, String matrixType, String matrixId, Object msg){
        Marker marker = MarkerFactory.getMarker("postProcessAfterInitialization");
        matrixType = "QRB1234";
        matrixId = "100";
        MDC.put("taskId",
                matrixType + "/" + matrixId + "_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
        log.info("info msg, msg is: {}", msg);
        MDC.clear();
    }

}