Added common log4j initialization.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 13 Jun 2002 18:32:00 +0000 (18:32 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 13 Jun 2002 18:32:00 +0000 (18:32 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@104 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/log/LoggerInit.java [new file with mode: 0755]

diff --git a/src/edu/internet2/middleware/shibboleth/log/LoggerInit.java b/src/edu/internet2/middleware/shibboleth/log/LoggerInit.java
new file mode 100755 (executable)
index 0000000..eac41f3
--- /dev/null
@@ -0,0 +1,38 @@
+package edu.internet2.middleware.shibboleth.log;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.xml.security.Init;
+
+/**
+ * 
+ * Servlet used to configure logging for other components.
+ * 
+ * @author Walter Hoehn
+ *
+ */
+public class LoggerInit extends HttpServlet {
+
+       private static Logger log = Logger.getLogger(LoggerInit.class.getName());
+
+       /**
+        * @see javax.servlet.GenericServlet#init()
+        */
+       public void init() throws ServletException {
+
+               super.init();
+               //Silliness to get around xmlsec doing its own configuration, ie: we might need to override it
+               Init.init();
+
+               String log4jConfigFileLocation = getServletConfig().getInitParameter("log4jConfigFileLocation");
+               if (log4jConfigFileLocation == null) {
+                       log4jConfigFileLocation = "/WEB-INF/conf/log4j.properties";
+               }
+               PropertyConfigurator.configure(getServletContext().getRealPath("/") + log4jConfigFileLocation);
+       }
+
+}
+