springboot项目需要记录日志的几种情况
Posted lele
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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); }
以上是关于springboot项目需要记录日志的几种情况的主要内容,如果未能解决你的问题,请参考以下文章