Archive for the ‘JAVA log4j’ tag
log4j配置环境变量迂回法
在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);