From 6765130f1bcd72c8bed0c4a9d55c59ca03c596fe Mon Sep 17 00:00:00 2001 From: Eric Zhao Date: Thu, 15 Nov 2018 17:09:23 +0800 Subject: [PATCH] Add log for fatal error when InitExecutor failed Signed-off-by: Eric Zhao --- .../com/alibaba/csp/sentinel/init/InitExecutor.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/init/InitExecutor.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/init/InitExecutor.java index 81e14228..99272b92 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/init/InitExecutor.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/init/InitExecutor.java @@ -45,17 +45,21 @@ public final class InitExecutor { ServiceLoader loader = ServiceLoader.load(InitFunc.class); List initList = new ArrayList(); for (InitFunc initFunc : loader) { - RecordLog.info("[Sentinel InitExecutor] Found init func: " + initFunc.getClass().getCanonicalName()); + RecordLog.info("[InitExecutor] Found init func: " + initFunc.getClass().getCanonicalName()); insertSorted(initList, initFunc); } for (OrderWrapper w : initList) { w.func.init(); - RecordLog.info(String.format("[Sentinel InitExecutor] Initialized: %s with order %d", + RecordLog.info(String.format("[InitExecutor] Initialized: %s with order %d", w.func.getClass().getCanonicalName(), w.order)); } } catch (Exception ex) { - RecordLog.info("[Sentinel InitExecutor] Init failed", ex); + RecordLog.warn("[InitExecutor] Init failed", ex); ex.printStackTrace(); + } catch (Error error) { + RecordLog.warn("[InitExecutor] Init failed with fatal error", error); + error.printStackTrace(); + throw error; } }