tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gl...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java
Date Thu, 23 May 2002 17:22:37 GMT
glenn       02/05/23 10:22:37

  Modified:    catalina/src/share/org/apache/catalina/connector
                        RequestBase.java
               catalina/src/share/org/apache/catalina/startup Catalina.java
  Log:
  Implement custom logger which can be used to capture System.out and
  System.err to a buffer for later use.  Used by Tomcat 4
  to capture this output when handling a request so any
  output can be sent to the webapp context log instead of
  catalina.out.
  
  Revision  Changes    Path
  1.19      +10 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestBase.java
  
  Index: RequestBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestBase.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RequestBase.java	18 Mar 2002 07:15:39 -0000	1.18
  +++ RequestBase.java	23 May 2002 17:22:37 -0000	1.19
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestBase.java,v
1.18 2002/03/18 07:15:39 remm Exp $
  - * $Revision: 1.18 $
  - * $Date: 2002/03/18 07:15:39 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestBase.java,v
1.19 2002/05/23 17:22:37 glenn Exp $
  + * $Revision: 1.19 $
  + * $Date: 2002/05/23 17:22:37 $
    *
    * ====================================================================
    *
  @@ -91,6 +91,7 @@
   import org.apache.catalina.util.Enumerator;
   import org.apache.catalina.util.RequestUtil;
   import org.apache.catalina.util.StringManager;
  +import org.apache.tomcat.util.log.SystemLogHandler;
   
   
   /**
  @@ -99,7 +100,7 @@
    * the connector-specific methods need to be implemented.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.18 $ $Date: 2002/03/18 07:15:39 $
  + * @version $Revision: 1.19 $ $Date: 2002/05/23 17:22:37 $
    * @deprecated
    */
   
  @@ -339,6 +340,7 @@
   
           this.context = context;
   
  +        SystemLogHandler.startCapture();
       }
   
   
  @@ -557,6 +559,10 @@
        */
       public void recycle() {
   
  +        String log = SystemLogHandler.stopCapture();
  +        if (log != null) {
  +            context.getServletContext().log(log);
  +        }
           attributes.clear();
           authorization = null;
           characterEncoding = null;
  
  
  
  1.48      +10 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java
  
  Index: Catalina.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- Catalina.java	22 Apr 2002 19:04:01 -0000	1.47
  +++ Catalina.java	23 May 2002 17:22:37 -0000	1.48
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
1.47 2002/04/22 19:04:01 craigmcc Exp $
  - * $Revision: 1.47 $
  - * $Date: 2002/04/22 19:04:01 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
1.48 2002/05/23 17:22:37 glenn Exp $
  + * $Revision: 1.48 $
  + * $Date: 2002/05/23 17:22:37 $
    *
    * ====================================================================
    *
  @@ -82,6 +82,7 @@
   import org.apache.catalina.Loader;
   import org.apache.commons.digester.Digester;
   import org.apache.commons.digester.Rule;
  +import org.apache.tomcat.util.log.SystemLogHandler;
   import org.xml.sax.Attributes;
   import org.xml.sax.InputSource;
   
  @@ -99,7 +100,7 @@
    * </u>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.47 $ $Date: 2002/04/22 19:04:01 $
  + * @version $Revision: 1.48 $ $Date: 2002/05/23 17:22:37 $
    */
   
   public class Catalina {
  @@ -494,6 +495,11 @@
                   // fatal internal errors
                   definition + "java.,org.apache.catalina.,org.apache.jasper.");
           }
  +
  +        // Replace System.out and System.err with a custom PrintStream
  +        SystemLogHandler log = new SystemLogHandler(System.out);
  +        System.setOut(log);
  +        System.setErr(log);
   
           Thread shutdownHook = new CatalinaShutdownHook();
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message