From e56ad0fd5e4521d1c2a0a650dc1f33fc05abe556 Mon Sep 17 00:00:00 2001 From: RB Date: Tue, 9 Aug 2022 11:30:05 +0800 Subject: [PATCH] better log --- .../core/service/trigger/RobotTriggerObserver.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/rebuild/core/service/trigger/RobotTriggerObserver.java b/src/main/java/com/rebuild/core/service/trigger/RobotTriggerObserver.java index f9365409a..f3a94103c 100644 --- a/src/main/java/com/rebuild/core/service/trigger/RobotTriggerObserver.java +++ b/src/main/java/com/rebuild/core/service/trigger/RobotTriggerObserver.java @@ -149,23 +149,23 @@ public class RobotTriggerObserver extends OperatingObserver { int depth = triggerSource == null ? 1 : triggerSource.getSourceDepth(); try { for (TriggerAction action : beExecuted) { - String w = String.format("Trigger.%d [ %s ] executed on record (%s) : %s", + String w = String.format("Trigger.%d [ %s ] executing on record (%s) : %s", depth, action.getType(), when.name(), primaryId); - System.out.println("[dev] " + w.replace("executed", "executing")); + log.info(w); try { Object ret = action.execute(context); - log.info(w + " > " + (ret == null ? "N" : ret)); + System.out.println("[dev] " + w + " > " + (ret == null ? "N" : ret)); - String log = ret == null ? "" : ret.toString(); + String log = ret == null ? null : ret.toString(); if (originTriggerSource) { - log += "; chain:" + getTriggerSource(); + if (log != null) log += "; "; + log += "chain:" + getTriggerSource(); } CommonsLog.createLog(TYPE_TRIGGER, context.getOperator(), action.getActionContext().getConfigId(), log); } catch (Throwable ex) { - log.info(w); // DataValidate 直接抛出 if (ex instanceof DataValidateException) throw ex; @@ -197,7 +197,6 @@ public class RobotTriggerObserver extends OperatingObserver { if (originTriggerSource) { log.info("Clear trigger-source : {}", getTriggerSource()); TRIGGER_SOURCE.remove(); - FieldAggregation.cleanTriggerChain(); } }