log4j --文件输出路径
利用占位符,然后再利用servlet给占位符赋值
log4j.rootLogger=debug,appender1log4j.appender.appender1=org.apache.log4j.FileAppender log4j.appender.appender1.File=${path}/log/log.htmlog4j.appender.appender1.layout=org.apache.log4j.HTMLLayout
package com.hugui.flower.servlet;import javax.servlet.ServletConfig;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;/** * 为log4j.properties文件中的占位符赋值,以便将日志信息输出到工程下 * @author Administrator * */public class Log4jInit extends HttpServlet {public void init(ServletConfig config) throws ServletException {String prefix = config.getServletContext().getRealPath("/");System.setProperty("path", prefix);}}