知识点整理之Web项目中Log4J的初始化
首先在web.xml中定义一个servlet,执行初始化
public void init(ServletConfig config) throws ServletException { String prefix = config.getServletContext().getRealPath("/"); // Log4J String log4jFile = config.getInitParameter("log4j"); String log4jConfigPath = prefix + log4jFile; PropertyConfigurator.configure(log4jConfigPath);}?