From 5f836e314550f4497df6e20c70021f9ed89152c1 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Sat, 13 Jul 2024 15:42:06 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-126951=20=E3=80=90=E4=BB=85FBP=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=91-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A0=8F-=E6=96=87=E4=BB=B6-=E9=80=89?= =?UTF-8?q?=E9=A1=B9-=E9=AB=98=E7=BA=A7-log=E5=AF=BC=E5=87=BA=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/boot/env/DesignEnvComponent.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) 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 fcb50ecb49..b4a1e91e85 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 @@ -31,6 +31,7 @@ import com.fr.cluster.ClusterBridge; import com.fr.cluster.lock.ClusterLock; import com.fr.config.BaseDBEnv; import com.fr.config.ConfigEvent; +import com.fr.config.Configuration; import com.fr.config.FinalPreferenceConfig; import com.fr.config.dao.DaoContext; import com.fr.config.dao.impl.BatchSubmitClassHelperDao; @@ -42,6 +43,8 @@ import com.fr.config.dao.impl.hibernate.HibernateXmlEnityDao; import com.fr.config.dao.impl.remote.RemoteClassHelperDao; import com.fr.config.dao.impl.remote.RemoteEntityDao; import com.fr.config.dao.impl.remote.RemoteXmlEntityDao; +import com.fr.config.holder.ConfigChangeListener; +import com.fr.config.holder.ValidateConfigManger; import com.fr.config.impl.ConfConfigProviderImpl; import com.fr.config.impl.ConfigInsecurityElementProviderImpl; import com.fr.decision.service.context.ServiceContext; @@ -54,6 +57,7 @@ import com.fr.design.backup.EnvBackupHelper; 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.Log4jUtils; import com.fr.intelli.metrics.Compute; import com.fr.intelli.metrics.DBMonitorInterceptor; @@ -86,6 +90,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.core.config.Configurator; import com.fr.third.net.bytebuddy.implementation.MethodDelegation; import com.fr.third.net.bytebuddy.matcher.ElementMatchers; import com.fr.third.org.hibernate.jdbc.AbstractWork; @@ -235,6 +240,25 @@ public class DesignEnvComponent { String realPath = Carina.properties(LoggerProperties.class).getXml(); URI uri = Log4jUtils.buildUserConfigURI(realPath); FRLogger.getLogger().config(uri); + // 日志配置更新的监听在FRLogger里面,fbp去掉了但是设计器本地还是需要这个监听的,初始化的时候监听一下 + listenConfig(); + } + + private void listenConfig() { + 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() {