详解参考:http://www.cnblogs.com/ITEagle/archive/2010/04/23/1718365.html
Logger.getRootLogger().getAppender("");
MyFileAppender.setFile();
动态改变日志位置:
package com.von.log; import java.io.File; import org.apache.log4j.RollingFileAppender; public class MyFileAppender extends RollingFileAppender { public void setFile(String file) { File fileCheck = new File(file); if(!fileCheck.exists()) { fileCheck.getParentFile().mkdirs(); } super.setFile(file);; super.activateOptions(); } }
原文:http://www.cnblogs.com/joyvon/p/7237199.html