Added log request interleaving.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 17 Sep 2002 00:35:14 +0000 (00:35 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 17 Sep 2002 00:35:14 +0000 (00:35 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@297 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/AAServlet.java
src/edu/internet2/middleware/shibboleth/log/LogServ.java

index 4855760..279d093 100755 (executable)
@@ -71,6 +71,8 @@ import edu.internet2.middleware.shibboleth.common.*;
 import edu.internet2.middleware.shibboleth.hs.*;
 import edu.internet2.middleware.eduPerson.*;
 import org.apache.log4j.Logger;
+import org.apache.log4j.MDC;
+import org.doomdark.uuid.UUIDGenerator;
 
 
 
@@ -87,11 +89,13 @@ public class AAServlet extends HttpServlet {
     ArpFactory arpFactory;
     private static Logger log = Logger.getLogger(AAServlet.class.getName());    
     
-    public void init(ServletConfig conf)
+    public void init()
        throws ServletException{
+               
+       MDC.put("serviceId", "[AA Core]");
        
        try{
-           super.init(conf);
+
            edu.internet2.middleware.eduPerson.Init.init();
            myName = getInitParameter("domain");
            dirUrl = getInitParameter("dirUrl");
@@ -143,6 +147,9 @@ public class AAServlet extends HttpServlet {
         throws ServletException, IOException {
                
        log.info("Recieved a request.");
+       MDC.put("serviceId", UUIDGenerator.getInstance().generateRandomBasedUUID());
+       MDC.put("remoteAddr", req.getRemoteAddr());
+       log.info("Handling request.");
 
        SAMLAttribute[] attrs = null;
        SAMLException ourSE = null;
index a41a38b..ad9cc2b 100755 (executable)
@@ -53,6 +53,7 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 
 import org.apache.log4j.Logger;
+import org.apache.log4j.MDC;
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.xml.security.Init;
 
@@ -81,6 +82,7 @@ public class LogServ extends HttpServlet {
                        log4jConfigFileLocation = "/WEB-INF/conf/log4j.properties";
                }
                PropertyConfigurator.configure(getServletContext().getRealPath("/") + log4jConfigFileLocation);
+                       MDC.put("serviceId", "[Logging Core]");
                log.info("Logger initialized.");
        }