mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-06-12 16:01:04 +08:00
LOG类统一化打印的代码优化
This commit is contained in:
@@ -478,20 +478,10 @@ public class FlowExecutor {
|
||||
catch (Exception e) {
|
||||
if (ObjectUtil.isNotNull(chain)) {
|
||||
String errMsg = StrUtil.format("chain[{}] execute error on slot[{}]", chain.getChainId(), slotIndex);
|
||||
if (BooleanUtil.isTrue(liteflowConfig.getPrintExecutionLog())) {
|
||||
LOG.error(errMsg, e);
|
||||
}
|
||||
else {
|
||||
LOG.error(errMsg);
|
||||
}
|
||||
LOG.error(errMsg, e);
|
||||
}
|
||||
else {
|
||||
if (BooleanUtil.isTrue(liteflowConfig.getPrintExecutionLog())) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
else {
|
||||
LOG.error(e.getMessage());
|
||||
}
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
// 如果是正常流程需要把异常设置到slot的exception属性里
|
||||
|
||||
@@ -373,6 +373,8 @@ public class LFLog implements Logger{
|
||||
public void error(String s, Throwable throwable) {
|
||||
if (isPrint()) {
|
||||
this.log.error(getRId() + s, throwable);
|
||||
}else{
|
||||
this.log.error(getRId() + s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -382,9 +382,7 @@ public class Slot {
|
||||
if (ObjectUtil.isNull(this.executeStepsStr)) {
|
||||
this.executeStepsStr = getExecuteStepStr(true);
|
||||
}
|
||||
if (LiteflowConfigGetter.get().getPrintExecutionLog()) {
|
||||
LOG.info("CHAIN_NAME[{}]\n{}", this.getChainName(), this.executeStepsStr);
|
||||
}
|
||||
LOG.info("CHAIN_NAME[{}]\n{}", this.getChainName(), this.executeStepsStr);
|
||||
}
|
||||
|
||||
public void addRollbackStep(CmpStep step) {
|
||||
@@ -418,9 +416,7 @@ public class Slot {
|
||||
if (ObjectUtil.isNull(this.rollbackStepsStr)) {
|
||||
this.rollbackStepsStr = getRollbackStepStr(true);
|
||||
}
|
||||
if (LiteflowConfigGetter.get().getPrintExecutionLog()) {
|
||||
LOG.info("ROLLBACK_CHAIN_NAME[{}]\n{}", this.getChainName(), this.rollbackStepsStr);
|
||||
}
|
||||
LOG.info("ROLLBACK_CHAIN_NAME[{}]\n{}", this.getChainName(), this.rollbackStepsStr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user