Kaynağa Gözat

LOG类统一化打印的代码优化

everywhere.z 5 ay önce
ebeveyn
işleme
b8b1cc0048

+ 2 - 12
liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java

@@ -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属性里

+ 2 - 0
liteflow-core/src/main/java/com/yomahub/liteflow/log/LFLog.java

@@ -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);
         }
     }
 

+ 2 - 6
liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java

@@ -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);
 	}