Commit 3124779c authored by yanzg's avatar yanzg

修复异常提醒,从而正确的跟踪异常信息

parent 3b48a1d6
......@@ -20,13 +20,11 @@ public class AspectLogStart {
private final CloudConfig cloudConfig;
private final LogLocal logLocal;
private final LogString logString;
private final LogCountTime logCountTime;
public AspectLogStart(CloudConfig cloudConfig, LogLocal logLocal, LogString logString, LogCountTime logCountTime) {
public AspectLogStart(CloudConfig cloudConfig, LogLocal logLocal, LogString logString) {
this.cloudConfig = cloudConfig;
this.logLocal = logLocal;
this.logString = logString;
this.logCountTime = logCountTime;
}
/**
......@@ -60,20 +58,20 @@ public class AspectLogStart {
body = StringHelper.EMPTY;
}
// 声明日志对象
LogInfoVo log = new LogInfoVo();
log.setLogId(StringHelper.getNewID());
log.setCreateDate(DateHelper.getDateTimeString(new Date()));
// 写入其他对象
log.setApplicationName(this.cloudConfig.getApplicationName());
log.setTag(tag);
log.setUrl(url);
log.setContent(body);
// 生命日志对象爱嗯
log.setLogId(StringHelper.getNewID());
// 开始记录到日志对象中
log.setLogFlag(logFlag && this.cloudConfig.isLogCommon());
// 开始记录到日志对象中,用于监测系统执行情况,超时时,则直接打印出日志
this.logLocal.startLog(log);
// 输出日志
boolean isLog = logFlag && this.cloudConfig.isLogCommon();
if (isLog) {
if (log.isLogFlag()) {
Log.info(cls, " %s [ %s ] request: %s", tag, url, body);
}
return log;
......
......@@ -55,6 +55,11 @@ public class LogInfoVo extends BaseVo {
*/
@ApiModelProperty(value = "创建时间", notes = "单位(毫秒)", required = false, example = "1987-11-24 23:15:18")
private String createDate;
/**
* 是否记录日志
*/
@ApiModelProperty(notes = "是否记录日志")
private boolean logFlag;
public String getLogId() {
return logId;
......@@ -135,4 +140,12 @@ public class LogInfoVo extends BaseVo {
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public boolean isLogFlag() {
return logFlag;
}
public void setLogFlag(boolean logFlag) {
this.logFlag = logFlag;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment