• springboot项目需要记录日志的几种情况


    记录接口调用者的入参

    String dataStr = request.getParameter("data");
    log.info("SupConf136Controller-get136List param is " + dataStr);

     记录消息的消息体

    log.info("===>rtSyncConfStoreK:" + msgBody);

     数据转换、解析的时候需要做判断,记录日志

    JSONObject json = (JSONObject)ite.next();
    if (json == null) {
        ite.remove();
        log.info("===>rtSyncConfStoreK error7:" + msgBody + ":" + json);
        dingDingComponent.sendBigDataGroup("===>rtSyncConfStoreK error7:" + msgBody + ":" + json);
        continue;
    }
    try {
        workDate = Date2Utils.parse(json.getString("work_date"), Date2Utils.FORMAT_LONG_6);
    } catch(Exception e) {
        log.info("rtSyncConfStoreK parseDate error", e);
    }

     对数据库做更新操作的时候

    try {
        iSupConfStoreKDAO.insertBatch(insertList);
    } catch(Exception e) {
        log.error("===>rtSyncConfStoreK error3:" + msgBody + ":"+ insertList, e);
        dingDingComponent.sendBigDataGroup("===>rtSyncConfStoreK error3:" + msgBody + ":"+ insertList + ":" + e);
    }
    try {
        iSupConfStoreKDAO.updateByRtAreaKSeqNoAndStoreNo(updateList);
    } catch(Exception e) {
        log.error("===>rtSyncConfStoreK error4:" + msgBody + ":"+ updateList, e);
        dingDingComponent.sendBigDataGroup("===>rtSyncConfStoreK error4:" + msgBody + ":"+ updateList + ":" + e);
    }
    try {
        iSupConfStoreKDAO.deleteByRtAreaKSeqNoAndStoreNo(deleteConfStoreKList);
    } catch(Exception e) {
        log.error("===>rtSyncConfStoreK error1:" + msgBody + ":" + deleteConfStoreKList, e);
        dingDingComponent.sendBigDataGroup("===>rtSyncConfStoreK error1:" + msgBody + ":" + deleteConfStoreKList + ":" + e);
    }
  • 相关阅读:
    作为一个非计算机专业的人,你们是怎样进入IT行业的?
    第一次写博客
    变卖
    近2周关于Shadowing的总结
    二十九岁步入而立之年的思考
    最美的回忆漫天的雪
    有趣的房东夫妇
    遥远的思恋—我的儿子
    五年一轮回
    写在开工之前我的2010
  • 原文地址:https://www.cnblogs.com/linux-centos/p/12129174.html
Copyright © 2020-2023  润新知