Author: remm
Date: Mon Apr 23 03:30:02 2007
New Revision: 531415

URL: http://svn.apache.org/viewvc?view=rev&rev=531415
Log:
- Proposed refactoring of dispatcher logging (remove some "I can't use a 
debugger" style logging as well).

Modified:
    
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java?view=diff&rev=531415&r1=531414&r2=531415
==============================================================================
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java 
(original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java 
Mon Apr 23 03:30:02 2007
@@ -47,8 +47,6 @@
 import org.apache.catalina.connector.ResponseFacade;
 import org.apache.catalina.util.InstanceSupport;
 import org.apache.catalina.util.StringManager;
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
 
 /**
  * Standard implementation of <code>RequestDispatcher</code> that allows a
@@ -181,18 +179,11 @@
         else
             this.support = new InstanceSupport(wrapper);
 
-        if ( log.isDebugEnabled() )
-            log.debug("servletPath=" + this.servletPath + ", pathInfo=" +
-                this.pathInfo + ", queryString=" + queryString +
-                ", name=" + this.name);
-
     }
 
 
     // ----------------------------------------------------- Instance Variables
 
-    private static Log log = LogFactory.getLog(ApplicationDispatcher.class);
-
     /**
      * The Context this RequestDispatcher is associated with.
      */
@@ -308,16 +299,12 @@
         
         // Reset any output that has been buffered, but keep headers/cookies
         if (response.isCommitted()) {
-            if ( log.isDebugEnabled() )
-                log.debug("  Forward on committed response --> ISE");
             throw new IllegalStateException
                 (sm.getString("applicationDispatcher.forward.ise"));
         }
         try {
             response.resetBuffer();
         } catch (IllegalStateException e) {
-            if ( log.isDebugEnabled() )
-                log.debug("  Forward resetBuffer() returned ISE: " + e);
             throw e;
         }
 
@@ -339,20 +326,12 @@
 
         // Handle a non-HTTP forward by passing the existing request/response
         if ((hrequest == null) || (hresponse == null)) {
-
-            if ( log.isDebugEnabled() )
-                log.debug(" Non-HTTP Forward");
-            
             processRequest(hrequest,hresponse,state);
-
         }
 
         // Handle an HTTP named dispatcher forward
         else if ((servletPath == null) && (pathInfo == null)) {
 
-            if ( log.isDebugEnabled() )
-                log.debug(" Named Dispatcher Forward");
-            
             ApplicationHttpRequest wrequest =
                 (ApplicationHttpRequest) wrapRequest(state);
             wrequest.setRequestURI(hrequest.getRequestURI());
@@ -371,9 +350,6 @@
         // Handle an HTTP path-based forward
         else {
 
-            if ( log.isDebugEnabled() )
-                log.debug(" Path Based Forward");
-
             ApplicationHttpRequest wrequest =
                 (ApplicationHttpRequest) wrapRequest(state);
             String contextPath = context.getPath();
@@ -408,16 +384,16 @@
         }
 
         // This is not a real close in order to support error processing
-        if ( log.isDebugEnabled() )
-            log.debug(" Disabling the response for futher output");
+        if (wrapper.getLogger().isDebugEnabled() )
+            wrapper.getLogger().debug(" Disabling the response for futher 
output");
 
         if  (response instanceof ResponseFacade) {
             ((ResponseFacade) response).finish();
         } else {
             // Servlet SRV.6.2.2. The Resquest/Response may have been wrapped
             // and may no longer be instance of RequestFacade 
-            if (log.isDebugEnabled()){
-                log.debug( " The Response is vehiculed using a wrapper: " 
+            if (wrapper.getLogger().isDebugEnabled()){
+                wrapper.getLogger().debug( " The Response is vehiculed using a 
wrapper: " 
                            + response.getClass().getName() );
             }
 
@@ -523,9 +499,6 @@
         // Handle a non-HTTP include
         if (!(request instanceof HttpServletRequest) ||
             !(response instanceof HttpServletResponse)) {
-
-            if ( log.isDebugEnabled() )
-                log.debug(" Non-HTTP Include");
             request.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
                     Integer.valueOf(ApplicationFilterFactory.INCLUDE));
             request.setAttribute(
@@ -537,9 +510,6 @@
         // Handle an HTTP named dispatcher include
         else if (name != null) {
 
-            if ( log.isDebugEnabled() )
-                log.debug(" Named Dispatcher Include");
-
             ApplicationHttpRequest wrequest =
                 (ApplicationHttpRequest) wrapRequest(state);
             wrequest.setAttribute(Globals.NAMED_DISPATCHER_ATTR, name);
@@ -558,9 +528,6 @@
         // Handle an HTTP path based include
         else {
 
-            if ( log.isDebugEnabled() )
-                log.debug(" Path Based Include");
-
             ApplicationHttpRequest wrequest =
                 (ApplicationHttpRequest) wrapRequest(state);
             String contextPath = context.getPath();
@@ -734,9 +701,9 @@
             if (filterChain != null)
                 filterChain.release();
         } catch (Throwable e) {
-            log.error(sm.getString("standardWrapper.releaseFilters",
+            
wrapper.getLogger().error(sm.getString("standardWrapper.releaseFilters",
                              wrapper.getName()), e);
-          //FIXME Exception handling needs to be simpiler to what is in the 
StandardWrapperValue
+            // FIXME: Exception handling needs to be simpiler to what is in 
the StandardWrapperValue
         }
 
         // Deallocate the allocated servlet instance



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to