diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index 93a47a9280..2a04889c52 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -55,6 +55,7 @@ import com.fr.env.detect.EnvDetectorCenter; import com.fr.event.EventDispatcher; import com.fr.general.FRLogger; import com.fr.general.log.Log4jConfig; +import com.fr.general.log.Log4jConfigFactory; import com.fr.general.log.Log4jUtils; import com.fr.intelli.metrics.Compute; import com.fr.intelli.metrics.DBMonitorInterceptor; @@ -88,6 +89,7 @@ import com.fr.stable.db.session.DBSession; import com.fr.stable.project.ProjectConstants; import com.fr.tenant.context.TenantContext; import com.fr.tenant.context.provider.CurrentTenantKey; +import com.fr.third.apache.logging.log4j.Level; import com.fr.third.apache.logging.log4j.core.config.Configurator; import com.fr.third.net.bytebuddy.implementation.MethodDelegation; import com.fr.third.net.bytebuddy.matcher.ElementMatchers; @@ -244,6 +246,8 @@ public class DesignEnvComponent { * ----------- logger -------- */ private void startLogger() { + // 获取本地的日志级别配置 + Log4jConfigFactory.getInstance().setRootLevel(Log4jConfig.getInstance().getRootLevel()); URI uri = Log4jUtils.buildUserConfigURI(StringUtils.EMPTY); FRLogger.getLogger().config(uri); // 日志配置更新的监听在FRLogger里面,fbp去掉了但是设计器本地还是需要这个监听的,初始化的时候监听一下 @@ -251,21 +255,19 @@ public class DesignEnvComponent { } private void listenConfig() { -/// 等fbp改完,现在先配合打包注释掉 -// ValidateConfigManger.getInstance().registerListener(new ConfigChangeListener() { -// -// @Override -// public boolean accept(Class configClass) { -// return configClass.equals(Log4jConfig.class); -// } -// -// @Override -// public void change() { -// // The root logger is the topmost logger with a name of "" (the empty string). -// Configurator.setAllLevels("", Log4jConfig.getInstance().getRootLevel()); -// } -// }); - + ValidateConfigManger.getInstance().registerListener(new ConfigChangeListener() { + + @Override + public boolean accept(Class configClass) { + return configClass.equals(Log4jConfig.class); + } + + @Override + public void change() { + // The root logger is the topmost logger with a name of "" (the empty string). + Configurator.setAllLevels("", Log4jConfig.getInstance().getRootLevel()); + } + }); } private void stopLogger() {