From 9fed593ab7a76e66a1f6e3552f27ab70f2d7ff7e Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 08 十月 2024 09:51:38 +0800 Subject: [PATCH] 优化log4j2.yml日志配置文件中的日志文件大小及文件数量配置 --- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java index 18b3460..82a3037 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java @@ -22,17 +22,19 @@ import com.dy.rtuMw.resource.ResourceUnit; import com.dy.rtuMw.resource.ResourceUnitConfigVo; import com.dy.common.springUtil.SpringContextUtil; -import com.dy.common.util.ConfigXml; +import com.dy.common.util.ConfigXml4Springboot; import com.dy.common.util.IDLongGenerator; import org.jdom2.Document; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ResourceLoader; import org.springframework.stereotype.Component; @Component public class Server { - private ConfigXml conf = null ; + private ConfigXml4Springboot conf = null ; private Document doc = null ; private boolean showStartInfo = false ; @@ -42,6 +44,9 @@ private String HttpSvPort ; @Value("${server.servlet.context-path}") private String HttpSvPath ; + + @Autowired + protected ResourceLoader resourceLoader ; private List<UnitInterface> units = new ArrayList<UnitInterface>() ; @@ -78,8 +83,8 @@ try { //ConfigProperties.init(this.getClass().getResourceAsStream("/config/config.properties"), false); - this.conf = new ConfigXml() ; - this.doc = this.conf.createDom(this.getClass(), "config.xml") ; + this.conf = new ConfigXml4Springboot() ; + this.doc = this.conf.createDom(this.resourceLoader, "config.xml") ; //////////////// //鏈嶅姟 閰嶇疆 this.showStartInfo = this.conf.getSetAttrBoolean(this.doc, "config.server", "showStartInfo", null, null) ; @@ -279,7 +284,7 @@ //RTU鏃ュ織鏂囦欢瀛樺偍鐩綍(鐩稿鐩綍) resVo.rtuLogDir = conf.getSetAttrTxt(doc, "config.resource", "rtuLogDir", null, false, null) ; //RTU鏃ュ織鏂囦欢鏈�澶у瓧鑺傛暟(KB) - resVo.rtuLogFileMaxSize = conf.getSetAttrPlusInt(doc, "config.resource", "rtuLogFileMaxSize", null, 100000, 2000000, null) ; + resVo.rtuLogFileMaxSize = conf.getSetAttrPlusInt(doc, "config.resource", "rtuLogFileMaxSize", null, 10, 2000000, null) ; //RTU鏃ュ織鏂囦欢鏈�澶ф枃浠舵暟 resVo.rtuLogFileMaxCount = conf.getSetAttrPlusInt(doc, "config.resource", "rtuLogFileMaxCount", null, 1, 10, null) ; @@ -323,8 +328,9 @@ */ ///////////////// - //RTU涓婅鏁版嵁澶勭悊妯″潡 + //RTU涓婅鏁版嵁澶勭悊妯″潡锛堜换鍔℃爲锛� RtuDataUnitConfigVo rducVo = new RtuDataUnitConfigVo(); + rducVo.resourceLoader = this.resourceLoader ; AdapterImp_RtuDataUnit rducAdap = new AdapterImp_RtuDataUnit(); rducAdap.setConfig(rducVo); RtuDataUnit rducUnit = RtuDataUnit.getInstance(); -- Gitblit v1.8.0