我在 mirth 环境中创建了一个频道。在这个频道中,我编写了用于创建两个动态日志文件的 javascript 代码。每当我启动频道文件时,都会创建频道文件,但 mirth 连接被挂起(不再进入正常状态,我正在重新启动每个时间)..请帮助我....
----logs.properties 文件-----
log4j.rootLogger=DEBUG
log4j.logger.DEFAULT_LOGGER=INHERIT, A1
log4j.logger.PROCESS_LOGGER=INHERIT, A2
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=c://test//${cname}//${fname}.log
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.maxFileSize=100KB
log4j.appender.A1.maxBackupIndex=10
log4j.appender.A1.layout.ConversionPattern=%d{yyyy-MMM-dd HH\:mm\:ss,SSS} [%t] %c %x%n %-5p %m%n
log4j.appender.A2=org.apache.log4j.RollingFileAppender
log4j.appender.A2.File=c://test//${cname}//${fname}_ack.log
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.maxFileSize=100KB
log4j.appender.A2.maxBackupIndex=10
log4j.appender.A2.layout.ConversionPattern=%d{yyyy-MMM-dd HH\:mm\:ss,SSS} [%t] %c %x%n %-5p %m%n
------javascript代码--------
importPackage(Packages.org.apache.log4j);
var channelName = Packages.com.mirth.connect.server.controllers.ChannelController.getInstance().getDeployedChannelById(channelId).getName();
var currentDate = DateUtil.getCurrentDate("yyyyMMdd");
Packages.java.lang.System.setProperty("fname", currentDate);
Packages.java.lang.System.setProperty("cname", channelName);
PropertyConfigurator.configure("C:/Program Files/Mirth Connect/conf/custom/logs.properties");
var logger1 = Logger.getLogger("DEFAULT_LOGGER");
var logger2 = Logger.getLogger("PROCESS_LOGGER");
logger1.info("default");
logger2.info("process");