amyroh      2004/09/17 11:34:19

  Modified:    coyote/src/java/org/apache/coyote/tomcat4 OutputBuffer.java
               http11/src/test/java/org/apache/coyote/http11
                        RandomAdapter.java
               jk/java/org/apache/ajp Ajp13Packet.java Logger.java
                        NegociationHandler.java
               jk/java/org/apache/ajp/tomcat4 JkServlet.java
               jk/java/org/apache/jk/common MsgAjp.java Shm.java
               jk/jkant/java/org/apache/jk/ant/compilers MsvcCompiler.java
                        MsvcLinker.java MwccCompiler.java MwldLinker.java
               naming/src/org/apache/naming/modules/fs FileDirContext.java
               util/java/org/apache/tomcat/util IntrospectionUtils.java
               util/java/org/apache/tomcat/util/buf B2CConverter.java
                        Base64.java UDecoder.java UEncoder.java
                        UTF8Decoder.java
               util/java/org/apache/tomcat/util/collections SimplePool.java
               util/java/org/apache/tomcat/util/http Cookies.java
                        Parameters.java ServerCookie.java
               util/java/org/apache/tomcat/util/threads Expirer.java
                        Reaper.java
  Log:
  More logging changes - let me know if you see any problems with'em.
  
  Revision  Changes    Path
  1.14      +5 -1      
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/OutputBuffer.java
  
  Index: OutputBuffer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/OutputBuffer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- OutputBuffer.java 24 Feb 2004 08:54:29 -0000      1.13
  +++ OutputBuffer.java 17 Sep 2004 18:34:18 -0000      1.14
  @@ -40,6 +40,9 @@
       implements ByteChunk.ByteOutputChannel, CharChunk.CharOutputChannel {
   
   
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( OutputBuffer.class );
  +
       // -------------------------------------------------------------- Constants
   
   
  @@ -664,7 +667,8 @@
   
   
       protected void log( String s ) {
  -     System.out.println("OutputBuffer: " + s);
  +        if (log.isDebugEnabled()) 
  +            log.debug("OutputBuffer: " + s);
       }
   
   
  
  
  
  1.3       +14 -6     
jakarta-tomcat-connectors/http11/src/test/java/org/apache/coyote/http11/RandomAdapter.java
  
  Index: RandomAdapter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/test/java/org/apache/coyote/http11/RandomAdapter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RandomAdapter.java        27 Feb 2004 15:14:08 -0000      1.2
  +++ RandomAdapter.java        17 Sep 2004 18:34:18 -0000      1.3
  @@ -33,6 +33,8 @@
   public class RandomAdapter
       implements Adapter {
   
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( RandomAdapter.class );
   
       public static final String CRLF = "\r\n";
       public static final byte[] b = "0123456789\r\n".getBytes();
  @@ -60,13 +62,15 @@
           case 0:
   
               // 0) Do nothing
  -            System.out.println("Response 0");
  +            if (log.isDebugEnabled())
  +                log.debug("Response 0");
               break;
   
           case 1:
   
               // 1) Set content length, and write the appropriate content
  -            System.out.println("Response 1");
  +            if (log.isDebugEnabled())
  +                log.debug("Response 1");
               res.setContentLength(b.length);
               bc.setBytes(b, 0, b.length);
               res.doWrite(bc);
  @@ -76,7 +80,8 @@
   
               // 2) Read the request data, and print out the number of bytes
               // read
  -            System.out.println("Response 2");
  +            if (log.isDebugEnabled())
  +                log.debug("Response 2");
               while (nRead >= 0) {
                   nRead = req.doRead(bc);
                   buf = ("Read " + nRead + " bytes\r\n").getBytes();
  @@ -88,7 +93,8 @@
           case 3:
   
               // 3) Return 204 (no content), while reading once on input
  -            System.out.println("Response 3");
  +            if (log.isDebugEnabled())
  +                log.debug("Response 3");
               res.setStatus(204);
               nRead = req.doRead(bc);
               res.setHeader("Info", "Read " + nRead + " bytes");
  @@ -97,7 +103,8 @@
           case 4:
   
               // 4) Do a request dump
  -            System.out.println("Response 4");
  +            if (log.isDebugEnabled())
  +                log.debug("Response 4");
               sbuf.append("Request dump:");
               sbuf.append(CRLF);
               sbuf.append(req.method());
  @@ -128,7 +135,8 @@
           default:
   
               // Response not implemented yet
  -            System.out.println("Response " + n + " is not implemented yet");
  +            if (log.isDebugEnabled())
  +                log.debug("Response " + n + " is not implemented yet");
   
           }
   
  
  
  
  1.15      +37 -24    
jakarta-tomcat-connectors/jk/java/org/apache/ajp/Ajp13Packet.java
  
  Index: Ajp13Packet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/Ajp13Packet.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Ajp13Packet.java  29 Aug 2004 17:14:41 -0000      1.14
  +++ Ajp13Packet.java  17 Sep 2004 18:34:18 -0000      1.15
  @@ -38,7 +38,10 @@
    * @author Costin Manolache
    */
   public class Ajp13Packet {
  -
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( Ajp13Packet.class );
  +    
       public static final String DEFAULT_CHAR_ENCODING = "8859_1";
       public static final int    AJP13_WS_HEADER       = 0x1234;
       public static final int    AJP13_SW_HEADER       = 0x4142;  // 'AB'
  @@ -149,8 +152,8 @@
           len      = getInt();
            
           if( mark != AJP13_WS_HEADER ) {
  -            // XXX Logging
  -            System.out.println("BAD packet " + mark);
  +            if (log.isDebugEnabled())
  +                log.debug("BAD packet " + mark);
               dump( "In: " );
               return -1;
           }
  @@ -272,8 +275,8 @@
       public void appendBytes( byte b[], int off, int numBytes ) {
           appendInt( numBytes );
           if( pos + numBytes >= buff.length ) {
  -            System.out.println("Buffer overflow " + buff.length + " " + pos + " " + 
numBytes );
  -            // XXX Log
  +            if (log.isDebugEnabled())
  +                log.debug("Buffer overflow " + buff.length + " " + pos + " " + 
numBytes );
           }
           System.arraycopy( b, off, buff, pos, numBytes);
           buff[pos + numBytes] = 0; // Terminating \0
  @@ -311,8 +314,8 @@
        */
       public void appendXBytes(byte[] b, int off, int numBytes) {
           if( pos + numBytes > buff.length ) {
  -        System.out.println("appendXBytes - Buffer overflow " + buff.length + " " + 
pos + " " + numBytes );
  -        // XXX Log
  +            if (log.isDebugEnabled())
  +                log.debug("appendXBytes - Buffer overflow " + buff.length + " " + 
pos + " " + numBytes );
           }
           System.arraycopy( b, off, buff, pos, numBytes);
           pos += numBytes;
  @@ -388,7 +391,8 @@
       public String getString() throws java.io.UnsupportedEncodingException {
           int length = getInt();
           if( (length == 0xFFFF) || (length == -1) ) {
  -            //           System.out.println("null string " + length);
  +            if (log.isDebugEnabled())
  +                log.debug("null string " + length);
               return null;
           }
           String s = new String(buff, pos, length, encoding);
  @@ -409,11 +413,13 @@
           int length = getInt();
           if( length > buff.length ) {
               // XXX Should be if(pos + length > buff.legth)?
  -            System.out.println("XXX Assert failed, buff too small ");
  +            if (log.isDebugEnabled())
  +                log.debug("XXX Assert failed, buff too small ");
           }
        
           if( (length == 0xFFFF) || (length == -1) ) {
  -            System.out.println("null string " + length);
  +            if (log.isDebugEnabled())
  +                log.debug("null string " + length);
               return 0;
           }
   
  @@ -445,7 +451,8 @@
       public int getXBytes(byte[] dest, int length) {
           if( length > buff.length ) {
           // XXX Should be if(pos + length > buff.legth)?
  -        System.out.println("XXX Assert failed, buff too small ");
  +            if (log.isDebugEnabled())
  +                log.debug("XXX Assert failed, buff too small ");
           }
   
           System.arraycopy( buff, pos,  dest, 0, length );
  @@ -481,27 +488,33 @@
        if( pkgEnd > buff.length )
            pkgEnd = buff.length;
           for( int i=start; i< start+16 ; i++ ) {
  -            if( i < pkgEnd)
  -                System.out.print( hex( buff[i] ) + " ");
  -            else 
  -                System.out.print( "   " );
  +            if( i < pkgEnd) {
  +                if (log.isDebugEnabled())
  +                    log.debug( hex( buff[i] ) + " ");
  +            } else {
  +                if (log.isDebugEnabled()) 
  +                    log.debug( "   " );
  +            }
           }
  -        System.out.print(" | ");
  +        if (log.isDebugEnabled()) 
  +            log.debug(" | ");
           for( int i=start; i < start+16 && i < pkgEnd; i++ ) {
  -            if( Character.isLetterOrDigit( (char)buff[i] ))
  -                System.out.print( new Character((char)buff[i]) );
  -            else
  -                System.out.print( "." );
  +            if( Character.isLetterOrDigit( (char)buff[i] )) {
  +                if (log.isDebugEnabled()) 
  +                    log.debug( new Character((char)buff[i]) );
  +            } else {
  +                if (log.isDebugEnabled()) 
  +                    log.debug( "." );
  +            }
           }
  -        System.out.println();
       }
       
       public void dump(String msg) {
  -        System.out.println( msg + ": " + buff + " " + pos +"/" + (len + 4));
  +        if (log.isDebugEnabled())
  +            log.debug( msg + ": " + buff + " " + pos +"/" + (len + 4));
   
           for( int j=0; j < len + 4; j+=16 )
               hexLine( j );
  -     
  -        System.out.println();
  +
       }
   }
  
  
  
  1.3       +7 -3      jakarta-tomcat-connectors/jk/java/org/apache/ajp/Logger.java
  
  Index: Logger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/Logger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Logger.java       24 Feb 2004 08:48:43 -0000      1.2
  +++ Logger.java       17 Sep 2004 18:34:18 -0000      1.3
  @@ -27,12 +27,16 @@
    */
   public class Logger {
       
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(Logger.class );
  +    
       /**
        * Log the given message.
        * @param msg The message to log.
        */
       public void log(String msg) {
  -        System.out.println("[Ajp13] " + msg);
  +        if (log.isDebugEnabled())
  +            log.debug("[Ajp13] " + msg);
       }
       
       /**
  @@ -41,7 +45,7 @@
        * @param t The error to log.
        */
       public void log(String msg, Throwable t) {
  -        System.out.println("[Ajp13] " + msg);
  -        t.printStackTrace(System.out);
  +        if (log.isDebugEnabled())
  +            log.debug("[Ajp13] " + msg, t);
       }
   }
  
  
  
  1.9       +8 -2      
jakarta-tomcat-connectors/jk/java/org/apache/ajp/NegociationHandler.java
  
  Index: NegociationHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/NegociationHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- NegociationHandler.java   24 Feb 2004 08:48:43 -0000      1.8
  +++ NegociationHandler.java   17 Sep 2004 18:34:18 -0000      1.9
  @@ -35,6 +35,10 @@
    */
   public class NegociationHandler extends AjpHandler
   {
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(NegociationHandler.class );
  +    
       // Initial Login Phase (web server -> servlet engine)
       public static final byte JK_AJP14_LOGINIT_CMD=0x10;
       
  @@ -240,7 +244,8 @@
                                 BaseRequest req )
        throws IOException
       {
  -        System.out.println("handleAjpMessage: " + type );
  +        if (log.isDebugEnabled())
  +            log.debug("handleAjpMessage: " + type );
        Ajp13Packet outBuf=ch.outBuf;
        // Valid requests when not logged:
        switch( type ) {
  @@ -522,6 +527,7 @@
       
       private static int debug=10;
       void log(String s) {
  -     System.out.println("Ajp14Negotiation: " + s );
  +        if (log.isDebugEnabled())
  +         log.ebug("Ajp14Negotiation: " + s );
       }
    }
  
  
  
  1.4       +1 -1      
jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/JkServlet.java
  
  Index: JkServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/JkServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JkServlet.java    24 Feb 2004 08:48:42 -0000      1.3
  +++ JkServlet.java    17 Sep 2004 18:34:18 -0000      1.4
  @@ -60,7 +60,7 @@
        super.init();
           if(wrapper == null) {
            log("No wrapper available, make sure the app is trusted");
  -         System.out.println("No wrapper available, make sure the app is trusted");
  +         //System.out.println("No wrapper available, make sure the app is trusted");
            return;
        }
   
  
  
  
  1.18      +5 -3      
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java
  
  Index: MsgAjp.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- MsgAjp.java       31 Aug 2004 23:52:52 -0000      1.17
  +++ MsgAjp.java       17 Sep 2004 18:34:18 -0000      1.18
  @@ -286,13 +286,15 @@
       }
       
       public void dump(String msg) {
  -        log.debug( msg + ": " + buf + " " + pos +"/" + (len + 4));
  +        if( log.isDebugEnabled() ) 
  +            log.debug( msg + ": " + buf + " " + pos +"/" + (len + 4));
           int max=pos;
           if( len + 4 > pos )
               max=len+4;
           if( max >1000 ) max=1000;
  -        for( int j=0; j < max; j+=16 )
  -            System.out.println( hexLine( buf, j, len ));
  +        if( log.isDebugEnabled() ) 
  +            for( int j=0; j < max; j+=16 ) 
  +                log.debug( hexLine( buf, j, len ));
        
       }
   
  
  
  
  1.15      +16 -12    jakarta-tomcat-connectors/jk/java/org/apache/jk/common/Shm.java
  
  Index: Shm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/Shm.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Shm.java  24 Feb 2004 08:48:42 -0000      1.14
  +++ Shm.java  17 Sep 2004 18:34:18 -0000      1.15
  @@ -213,7 +213,8 @@
               appendString(msg, instanceId, c2b);
           }
   
  -        System.out.println("Register " + instanceId );
  +        if (log.isDebugEnabled())
  +            log.debug("Register " + instanceId );
           this.invoke( msg, mCtx );
       }
   
  @@ -233,7 +234,8 @@
           msg.appendInt( 0 );
           msg.appendInt( 0 );
           
  -        System.out.println("UnRegister " + slotName );
  +        if (log.isDebugEnabled())
  +            log.debug("UnRegister " + slotName );
           this.invoke( msg, mCtx );
       }
   
  @@ -293,16 +295,18 @@
       }
   
       public void setHelp( boolean b ) {
  -        System.out.println("Usage: ");
  -        System.out.println("  Shm [OPTIONS]");
  -        System.out.println();
  -        System.out.println("  -file SHM_FILE");
  -        System.out.println("  -group GROUP ( can be specified multiple times )");
  -        System.out.println("  -host HOST");
  -        System.out.println("  -port PORT");
  -        System.out.println("  -unixSocket UNIX_FILE");
  -        //        System.out.println("  -priority XXX");
  -        //        System.out.println("  -lbFactor XXX");
  +        if (log.isDebugEnabled()) {
  +            log.debug("Usage: ");
  +            log.debug("  Shm [OPTIONS]");
  +            log.debug("");
  +            log.debug("  -file SHM_FILE");
  +            log.debug("  -group GROUP ( can be specified multiple times )");
  +            log.debug("  -host HOST");
  +            log.debug("  -port PORT");
  +            log.debug("  -unixSocket UNIX_FILE");
  +            //        log.debug("  -priority XXX");
  +            //        log.debug("  -lbFactor XXX");
  +        }
           help=true;
           return;
       }
  
  
  
  1.9       +1 -1      
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MsvcCompiler.java
  
  Index: MsvcCompiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MsvcCompiler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MsvcCompiler.java 24 Feb 2004 08:48:44 -0000      1.8
  +++ MsvcCompiler.java 17 Sep 2004 18:34:18 -0000      1.9
  @@ -151,7 +151,7 @@
           }
           catch (IOException ioe)
           {
  -            System.out.println("Caught IOException");
  +            log("Caught IOException");
           }
           finally
           {
  
  
  
  1.9       +1 -1      
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MsvcLinker.java
  
  Index: MsvcLinker.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MsvcLinker.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MsvcLinker.java   24 Feb 2004 08:48:44 -0000      1.8
  +++ MsvcLinker.java   17 Sep 2004 18:34:18 -0000      1.9
  @@ -155,7 +155,7 @@
           }
           catch (IOException ioe)
           {
  -            System.out.println("Caught IOException");
  +            log("Caught IOException");
           }
           finally
           {
  
  
  
  1.11      +1 -1      
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwccCompiler.java
  
  Index: MwccCompiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwccCompiler.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MwccCompiler.java 24 Feb 2004 08:48:44 -0000      1.10
  +++ MwccCompiler.java 17 Sep 2004 18:34:18 -0000      1.11
  @@ -146,7 +146,7 @@
           }
           catch (IOException ioe)
           {
  -            System.out.println("Caught IOException");
  +            log("Caught IOException");
           }
           finally
           {
  
  
  
  1.11      +1 -1      
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwldLinker.java
  
  Index: MwldLinker.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwldLinker.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MwldLinker.java   24 Feb 2004 08:48:44 -0000      1.10
  +++ MwldLinker.java   17 Sep 2004 18:34:18 -0000      1.11
  @@ -180,7 +180,7 @@
           }
           catch (IOException ioe)
           {
  -            System.out.println("Caught IOException");
  +            log("Caught IOException");
           }
           finally
           {
  
  
  
  1.8       +6 -4      
jakarta-tomcat-connectors/naming/src/org/apache/naming/modules/fs/FileDirContext.java
  
  Index: FileDirContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/naming/src/org/apache/naming/modules/fs/FileDirContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FileDirContext.java       24 Feb 2004 08:58:09 -0000      1.7
  +++ FileDirContext.java       17 Sep 2004 18:34:18 -0000      1.8
  @@ -188,7 +188,8 @@
   
       public void setAttribute( String name, Object v ) {
           new Throwable().printStackTrace();
  -        System.out.println(name + " " + v );
  +        if (log.isDebugEnabled())
  +            log.debug(name + " " + v );
       }
   
       // -------------------- BaseDirContext implementation --------------------
  @@ -204,9 +205,10 @@
       public Object lookup(Name nameObj, boolean resolveLinkx)
           throws NamingException
       {
  -        if( log.isDebugEnabled() ) log.debug( "lookup " + nameObj );
  -
  -        System.out.println("XXX " + nameObj.get(0));
  +        if( log.isDebugEnabled() ) {
  +            log.debug( "lookup " + nameObj );
  +            log.debug( nameObj.get(0));
  +        }
           if( "fs:".equals( nameObj.get(0).toString() ))
               nameObj=nameObj.getSuffix(1);
           
  
  
  
  1.11      +19 -8     
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/IntrospectionUtils.java
  
  Index: IntrospectionUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/IntrospectionUtils.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- IntrospectionUtils.java   2 Sep 2004 00:48:12 -0000       1.10
  +++ IntrospectionUtils.java   17 Sep 2004 18:34:18 -0000      1.11
  @@ -36,6 +36,10 @@
    */
   public final class IntrospectionUtils {
   
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( IntrospectionUtils.class );
  +    
       /**
        * Call execute() - any ant-like task should work
        */
  @@ -68,11 +72,13 @@
           params[1] = Object.class;
           executeM = findMethod(c, "setAttribute", params);
           if (executeM == null) {
  -            System.out.println("No setAttribute in " + proxy.getClass());
  +            if (log.isDebugEnabled())
  +                log.debug("No setAttribute in " + proxy.getClass());
               return;
           }
           if (false)
  -            System.out.println("Setting " + n + "=" + v + "  in " + proxy);
  +            if (log.isDebugEnabled())
  +                log.debug("Setting " + n + "=" + v + "  in " + proxy);
           executeM.invoke(proxy, new Object[] { n, v });
           return;
       }
  @@ -87,7 +93,8 @@
           params[0] = String.class;
           executeM = findMethod(c, "getAttribute", params);
           if (executeM == null) {
  -            System.out.println("No getAttribute in " + proxy.getClass());
  +            if (log.isDebugEnabled())
  +                log.debug("No getAttribute in " + proxy.getClass());
               return null;
           }
           return executeM.invoke(proxy, new Object[] { n });
  @@ -216,9 +223,11 @@
        * Debug method, display the classpath
        */
       public static void displayClassPath(String msg, URL[] cp) {
  -        System.out.println(msg);
  -        for (int i = 0; i < cp.length; i++) {
  -            System.out.println(cp[i].getFile());
  +        if (log.isDebugEnabled()) {
  +            log.debug(msg);
  +            for (int i = 0; i < cp.length; i++) {
  +                log.debug(cp[i].getFile());
  +            }
           }
       }
   
  @@ -557,7 +566,8 @@
                   // That's a bug, but we can work around and be nice.
                   f = new File(System.getProperty("java.home") + "/lib/tools.jar");
                   if (f.exists()) {
  -                    System.out.println("Detected strange java.home value "
  +                    if (log.isDebugEnabled())
  +                        log.debug("Detected strange java.home value "
                               + System.getProperty("java.home")
                               + ", it should point to jre");
                   }
  @@ -983,6 +993,7 @@
       static final int dbg = 0;
   
       static void d(String s) {
  -        System.out.println("IntrospectionUtils: " + s);
  +        if (log.isDebugEnabled())
  +            log.debug("IntrospectionUtils: " + s);
       }
   }
  
  
  
  1.4       +7 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/B2CConverter.java
  
  Index: B2CConverter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/B2CConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- B2CConverter.java 24 Feb 2004 08:50:06 -0000      1.3
  +++ B2CConverter.java 17 Sep 2004 18:34:18 -0000      1.4
  @@ -34,6 +34,11 @@
    *  be used in a later version or after the remaining optimizations.
    */
   public class B2CConverter {
  +    
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( B2CConverter.class );
  +    
       private IntermediateInputStream iis;
       private ReadConvertor conv;
       private String encoding;
  @@ -109,7 +114,8 @@
   
       private final int debug=0;
       void log( String s ) {
  -     System.out.println("B2CConverter: " + s );
  +        if (log.isDebugEnabled())
  +            log.debug("B2CConverter: " + s );
       }
   
       // -------------------- Not used - the speed improvemnt is quite small
  
  
  
  1.5       +6 -2      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/Base64.java
  
  Index: Base64.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/Base64.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Base64.java       29 Aug 2004 17:14:41 -0000      1.4
  +++ Base64.java       17 Sep 2004 18:34:18 -0000      1.5
  @@ -33,6 +33,9 @@
   public final class Base64 {
   
   
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( Base64.class );
  +    
       static private final int  BASELENGTH         = 255;
       static private final int  LOOKUPLENGTH       = 63;
       static private final int  TWENTYFOURBITGROUP = 24;
  @@ -246,7 +249,8 @@
            
            if ( v >= 64 ) {
                if( chars[i] != '=' )
  -                 System.out.println("Wrong char in base64: " + chars[i]);
  +                    if (log.isDebugEnabled())
  +                        log.debug("Wrong char in base64: " + chars[i]);
            } else {
                acc= ( acc << 6 ) | v;
                shift += 6;
  
  
  
  1.9       +5 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/UDecoder.java
  
  Index: UDecoder.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/UDecoder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- UDecoder.java     24 Feb 2004 08:50:06 -0000      1.8
  +++ UDecoder.java     17 Sep 2004 18:34:18 -0000      1.9
  @@ -29,6 +29,9 @@
    */
   public final class UDecoder {
       
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(UDecoder.class );
  +    
       public UDecoder() 
       {
       }
  @@ -266,7 +269,8 @@
   
       private final static int debug=0;
       private static void log( String s ) {
  -     System.out.println("URLDecoder: " + s );
  +        if (log.isDebugEnabled())
  +            log.debug("URLDecoder: " + s );
       }
   
   }
  
  
  
  1.6       +5 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/UEncoder.java
  
  Index: UEncoder.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/UEncoder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UEncoder.java     29 Aug 2004 17:14:41 -0000      1.5
  +++ UEncoder.java     17 Sep 2004 18:34:18 -0000      1.6
  @@ -33,6 +33,9 @@
    */
   public final class UEncoder {
   
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(UEncoder.class );
  +    
       // Not static - the set may differ ( it's better than adding
       // an extra check for "/", "+", etc
       private BitSet safeChars=null;
  @@ -172,6 +175,7 @@
       }
   
       private static void log( String s ) {
  -     System.out.println("Encoder: " + s );
  +        if (log.isDebugEnabled())
  +            log.debug("Encoder: " + s );
       }
   }
  
  
  
  1.4       +7 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/UTF8Decoder.java
  
  Index: UTF8Decoder.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/UTF8Decoder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UTF8Decoder.java  24 Feb 2004 08:50:06 -0000      1.3
  +++ UTF8Decoder.java  17 Sep 2004 18:34:18 -0000      1.4
  @@ -31,6 +31,11 @@
    * @author ( Xml-Xerces )
    */
   public final class UTF8Decoder extends B2CConverter {
  +    
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(UTF8Decoder.class );
  +    
       // may have state !!
       
       public UTF8Decoder() {
  @@ -137,7 +142,8 @@
   
       private static int debug=1;
       void log(String s ) {
  -     System.out.println("UTF8Decoder: " + s );
  +        if (log.isDebugEnabled())
  +            log.debug("UTF8Decoder: " + s );
       }
       
   }
  
  
  
  1.4       +7 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/collections/SimplePool.java
  
  Index: SimplePool.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/collections/SimplePool.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimplePool.java   24 Feb 2004 08:50:05 -0000      1.3
  +++ SimplePool.java   17 Sep 2004 18:34:18 -0000      1.4
  @@ -25,6 +25,11 @@
    * @author Costin Manolache
    */
   public final class SimplePool  {
  +    
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(SimplePool.class );
  +    
       /*
        * Where the threads are held.
        */
  @@ -116,6 +121,7 @@
       }
       
       private void log( String s ) {
  -     System.out.println("SimplePool: " + s );
  +        if (log.isDebugEnabled())
  +            log.debug("SimplePool: " + s );
       }
   }
  
  
  
  1.10      +5 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/Cookies.java
  
  Index: Cookies.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/Cookies.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Cookies.java      26 Aug 2004 19:31:03 -0000      1.9
  +++ Cookies.java      17 Sep 2004 18:34:18 -0000      1.10
  @@ -34,6 +34,9 @@
    */
   public final class Cookies { // extends MultiMap {
   
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(Cookies.class );
  +    
       // expected average number of cookies per request
       public static final int INITIAL_SIZE=4; 
       ServerCookie scookies[]=new ServerCookie[INITIAL_SIZE];
  @@ -434,7 +437,8 @@
       // log
       static final int dbg=0;
       public void log(String s ) {
  -        System.out.println("Cookies: " + s);
  +        if (log.isDebugEnabled())
  +            log.debug("Cookies: " + s);
       }
   
       /*
  
  
  
  1.15      +6 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/Parameters.java
  
  Index: Parameters.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/Parameters.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Parameters.java   9 Aug 2004 16:00:10 -0000       1.14
  +++ Parameters.java   17 Sep 2004 18:34:18 -0000      1.15
  @@ -32,6 +32,10 @@
    */
   public final class Parameters extends MultiMap {
   
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(Parameters.class );
  +    
       // Transition: we'll use the same Hashtable( String->String[] )
       // for the beginning. When we are sure all accesses happen through
       // this class - we can switch to MultiMap
  @@ -526,7 +530,8 @@
   
       private static int debug=0;
       private void log(String s ) {
  -     System.out.println("Parameters: " + s );
  +        if (log.isDebugEnabled())
  +            log.debug("Parameters: " + s );
       }
      
       // -------------------- Old code, needs rewrite --------------------
  
  
  
  1.6       +7 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/ServerCookie.java
  
  Index: ServerCookie.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/ServerCookie.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ServerCookie.java 26 Jun 2004 21:37:52 -0000      1.5
  +++ ServerCookie.java 17 Sep 2004 18:34:19 -0000      1.6
  @@ -34,6 +34,11 @@
    *  and the facade will convert it to the external representation.
    */
   public class ServerCookie implements Serializable {
  +    
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(ServerCookie.class );
  +    
       private MessageBytes name=MessageBytes.newInstance();
       private MessageBytes value=MessageBytes.newInstance();
   
  @@ -286,7 +291,8 @@
       // log
       static final int dbg=1;
       public static void log(String s ) {
  -     System.out.println("ServerCookie: " + s);
  +        if (log.isDebugEnabled())
  +            log.debug("ServerCookie: " + s);
       }
   
   }
  
  
  
  1.8       +6 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/threads/Expirer.java
  
  Index: Expirer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/threads/Expirer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Expirer.java      24 Feb 2004 08:50:05 -0000      1.7
  +++ Expirer.java      17 Sep 2004 18:34:19 -0000      1.8
  @@ -24,6 +24,10 @@
    */
   public final class Expirer  implements ThreadPoolRunnable
   {
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(Expirer.class );
  +    
       // We can use Event/Listener, but this is probably simpler
       // and more efficient
       public static interface ExpireCallback {
  @@ -149,6 +153,7 @@
   
       private static final int dL=0;
       private void debug( String s ) {
  -     System.out.println("Expirer: " + s );
  +        if (log.isDebugEnabled())
  +            log.debug("Expirer: " + s );
       }
   }
  
  
  
  1.7       +7 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/threads/Reaper.java
  
  Index: Reaper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/threads/Reaper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Reaper.java       24 Feb 2004 08:50:05 -0000      1.6
  +++ Reaper.java       17 Sep 2004 18:34:19 -0000      1.7
  @@ -26,6 +26,11 @@
    * @author Costin Manolache
    */
   public class Reaper extends Thread {
  +    
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog(Reaper.class );
  +    
       private boolean daemon = false;
   
       public Reaper() {
  @@ -88,7 +93,8 @@
   
       public synchronized void stopReaper() {
           running = false;
  -        System.out.println("Stop reaper ");
  +        if (log.isDebugEnabled())
  +            log.debug("Stop reaper ");
           this.interrupt(); // notify() doesn't stop sleep
       }
   
  
  
  

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

Reply via email to