ingo@1022: /* ingo@1022: * Copyright (c) 2010 by Intevation GmbH ingo@1022: * ingo@1022: * This program is free software under the LGPL (>=v2.1) ingo@1022: * Read the file LGPL.txt coming with the software for details ingo@1022: * or visit http://www.gnu.org/licenses/ if it does not exist. ingo@1022: */ ingo@1022: sascha@700: package de.intevation.gnv.servlet; sascha@700: sascha@700: import javax.servlet.ServletConfig; sascha@700: import javax.servlet.ServletException; sascha@700: sascha@700: import org.apache.log4j.Logger; sascha@700: import org.apache.log4j.PropertyConfigurator; tim@961: import org.apache.struts.action.ActionServlet; sascha@700: tim@961: import de.intevation.gnv.propertiesreader.PropertiesReaderFactory; sascha@700: sascha@700: /** sascha@700: * The GNV ActionServlet. tim@961: * This Servelt will be used to handle all requests which are tim@961: * send to the GNV-WebClient. ingo@721: * sascha@700: * @author Tim Englich sascha@700: */ sascha@700: public class GNVActionServlet extends ActionServlet { ingo@721: sascha@700: /** sascha@700: * the logger, used to log exceptions and additonaly information sascha@700: */ sascha@700: private static Logger log = null; sascha@700: tim@961: /** tim@961: * The id which must be used to lookup the path to the tim@961: * log4j.properties file which is configured tim@961: * in the web.xml tim@961: */ tim@961: private final static String LOGGINIG_CONFIG_FILE_ID = "de.intevation.gnv." + tim@961: "servlet.log4j.configuration"; sascha@700: tim@961: /** tim@961: * The UID of this class. tim@961: */ sascha@700: private static final long serialVersionUID = 3597396283436383943L; sascha@700: ingo@721: sascha@700: @Override sascha@700: public void init(ServletConfig config) throws ServletException { sascha@700: super.init(config); sascha@700: try { sascha@700: String path = config.getServletContext().getRealPath("/") sascha@700: + config.getInitParameter(LOGGINIG_CONFIG_FILE_ID); sascha@700: PropertyConfigurator.configure(path); sascha@700: log = Logger.getLogger(GNVActionServlet.class); sascha@700: } catch (Exception e) { sascha@700: log.error(e, e); sascha@700: } sascha@700: log.info("PropertiesReader will be configured."); sascha@700: PropertiesReaderFactory.getInstance().initPropertiesReader(config); sascha@700: } sascha@700: } sascha@700: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :