1 package org.jahia.clipbuilder; 2 3 import javax.servlet.*; 4 import javax.servlet.http.*; 5 import java.io.*; 6 import org.apache.log4j.xml.DOMConfigurator; 7 import javax.xml.parsers.*; 8 9 10 15 public class InitServlet extends HttpServlet { 16 private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(InitServlet.class); 17 18 19 24 public void init() throws ServletException { 25 initLog4j(); 26 } 27 28 29 37 public void service(HttpServletRequest request, HttpServletResponse response) throws 38 IOException, ServletException { 39 41 } 42 43 44 47 public void destroy() { 48 } 49 50 51 52 57 private void initLog4j() throws FactoryConfigurationError { 58 String prefix = getServletContext().getRealPath("/"); 59 String xmlFile = getInitParameter("log4j-xml-init-file"); 60 if (xmlFile != null) { 62 DOMConfigurator.configure(prefix + xmlFile); 63 } 64 65 logger.debug("Log4j configured, initializing the rest of the ..."); 66 logger.debug("[ Initialize the context ]"); 67 } 68 69 70 71 72 } 73 | Popular Tags |