remm        2005/08/31 07:06:40

  Modified:    webapps/docs changelog.xml
               catalina/src/share/org/apache/catalina/startup Embedded.java
                        Catalina.java
  Log:
  - Fix FIXME: Allow configuration of stream redirection in Embedded.
  
  Revision  Changes    Path
  1.366     +3 -0      jakarta-tomcat-catalina/webapps/docs/changelog.xml
  
  Index: changelog.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
  retrieving revision 1.365
  retrieving revision 1.366
  diff -u -r1.365 -r1.366
  --- changelog.xml     30 Aug 2005 22:39:36 -0000      1.365
  +++ changelog.xml     31 Aug 2005 14:06:40 -0000      1.366
  @@ -40,6 +40,9 @@
         <fix>
           <bug>36343</bug>: Only normalize out backslash on Windows platforms. 
(billbarker)
         </fix>
  +      <fix>
  +        Allow configuring standard stream redirection (remm)
  +      </fix>
       </changelog>
     </subsection>
     
  
  
  
  1.28      +43 -1     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Embedded.java
  
  Index: Embedded.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Embedded.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Embedded.java     8 Dec 2004 14:34:56 -0000       1.27
  +++ Embedded.java     31 Aug 2005 14:06:40 -0000      1.28
  @@ -46,6 +46,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.tomcat.util.IntrospectionUtils;
  +import org.apache.tomcat.util.log.SystemLogHandler;
   
   
   /**
  @@ -140,6 +141,12 @@
   
   
       /**
  +     * Is standard streams redirection enabled ?
  +     */
  +    protected boolean redirectStreams = true;
  +
  +
  +    /**
        * The set of Engines that have been deployed in this server.  Normally
        * there will only be one.
        */
  @@ -219,6 +226,31 @@
   
   
       /**
  +     * Return true if redirction of standard streams is enabled.
  +     */
  +    public boolean isRedirectStreams() {
  +
  +        return (this.redirectStreams);
  +
  +    }
  +
  +
  +    /**
  +     * Enables or disables naming support.
  +     *
  +     * @param useNaming The new use naming value
  +     */
  +    public void setRedirectStreams(boolean redirectStreams) {
  +
  +        boolean oldRedirectStreams = this.redirectStreams;
  +        this.redirectStreams = redirectStreams;
  +        support.firePropertyChange("redirectStreams", new 
Boolean(oldRedirectStreams),
  +                                   new Boolean(this.redirectStreams));
  +
  +    }
  +
  +
  +    /**
        * Return the default Realm for our Containers.
        */
       public Realm getRealm() {
  @@ -932,6 +964,16 @@
   
       }
   
  +    
  +    protected void initStreams() {
  +        if (redirectStreams) {
  +            // Replace System.out and System.err with a custom PrintStream
  +            SystemLogHandler systemlog = new SystemLogHandler(System.out);
  +            System.setOut(systemlog);
  +            System.setErr(systemlog);
  +        }
  +    }
  +    
   
       // -------------------------------------------------------- Private 
Methods
   
  
  
  
  1.38      +3 -7      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Catalina.java
  
  Index: Catalina.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- Catalina.java     30 Jun 2005 13:04:34 -0000      1.37
  +++ Catalina.java     31 Aug 2005 14:06:40 -0000      1.38
  @@ -31,7 +31,6 @@
   import org.apache.catalina.core.StandardServer;
   import org.apache.tomcat.util.digester.Digester;
   import org.apache.tomcat.util.digester.Rule;
  -import org.apache.tomcat.util.log.SystemLogHandler;
   import org.xml.sax.Attributes;
   import org.xml.sax.InputSource;
   
  @@ -480,11 +479,8 @@
               return;
           }
   
  -        // Replace System.out and System.err with a custom PrintStream
  -        // TODO: move to Embedded, make it configurable
  -        SystemLogHandler systemlog = new SystemLogHandler(System.out);
  -        System.setOut(systemlog);
  -        System.setErr(systemlog);
  +        // Stream redirection
  +        initStreams();
   
           // Start the new server
           if (server instanceof Lifecycle) {
  
  
  

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

Reply via email to