public class ApplicationListener implements ServletContextListener { public static String WEB_PATH = null; public void contextInitialized(ServletContextEvent sce) { String webPath = sce.getServletContext().getRealPath("/"); ApplicationListener.WEB_PATH = webPath; System.setProperty("PROJECT_LOG", webPath); System.setProperty("WEB_PATH", webPath); LogUtil.init(webPath + "/config/log4j.xml"); } public void contextDestroyed(ServletContextEvent sce) { } } |