rexis.cn

一张相片 一段故事

Archive for the ‘JAVA log4j’ tag

log4j配置环境变量迂回法

without comments

在log4j.properties中配置输入文件
log4j.appender.A1.File= ${JBOSS_HOME}/server/default/log/my.log

JAVA中加载配置
//从系统环境变量中取出JBOSS_HOME路径设置为系统property
System.setProperty(“JBOSS_HOME”, System.getenv(“JBOSS_HOME”));
//读取log4j配置
PropertyConfigurator.configure(this.class.getResource(“/”).getPath() + “log4j.properties”);
logger = Logger.getLogger(this.class);

Written by 北

五月 30th, 2009 at 2:10 上午

Posted in program

Tagged with