amyroh      2004/09/16 16:19:55

  Modified:    catalina/src/share/org/apache/catalina/ant JMXQueryTask.java
                        JMXSetTask.java
               catalina/src/share/org/apache/catalina/servlets
                        WebdavServlet.java
               catalina/src/share/org/apache/catalina/startup Catalina.java
                        CatalinaProperties.java
               catalina/src/share/org/apache/catalina/util
                        ProcessEnvironment.java ProcessHelper.java
                        StringManager.java
               catalina/src/share/org/apache/naming/resources
                        WARDirContext.java
  Log:
  Remove System.out and use commons.logging instead - part 1.
  
  Revision  Changes    Path
  1.5       +2 -2      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/JMXQueryTask.java
  
  Index: JMXQueryTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/JMXQueryTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JMXQueryTask.java 29 Aug 2004 16:46:09 -0000      1.4
  +++ JMXQueryTask.java 16 Sep 2004 23:19:54 -0000      1.5
  @@ -72,7 +72,7 @@
       public void execute() throws BuildException {
           super.execute();
           String queryString = (query == null) ? "":("?qry="+query);
  -        System.out.println ("INFO:Query string is " + queryString); 
  +        log("Query string is " + queryString); 
           execute ("/jmxproxy/" + queryString);
       }
   }
  
  
  
  1.5       +2 -2      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/JMXSetTask.java
  
  Index: JMXSetTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/JMXSetTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JMXSetTask.java   26 May 2004 15:29:30 -0000      1.4
  +++ JMXSetTask.java   16 Sep 2004 23:19:54 -0000      1.5
  @@ -108,7 +108,7 @@
               throw new BuildException
                   ("Must specify 'bean', 'attribute' and 'value' attributes");
           }
  -        System.out.println ("INFO: Setting attribute " + attribute +
  +        log("Setting attribute " + attribute +
                               " in bean " + bean +
                               " to " + value); 
           execute("/jmxproxy/?set=" + bean 
  
  
  
  1.18      +5 -5      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java
  
  Index: WebdavServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- WebdavServlet.java        29 Aug 2004 16:46:12 -0000      1.17
  +++ WebdavServlet.java        16 Sep 2004 23:19:54 -0000      1.18
  @@ -239,7 +239,7 @@
   
           if (debug > 0) {
               String path = getRelativePath(req);
  -            System.out.println("[" + method + "] " + path);
  +            log("[" + method + "] " + path);
           }
   
           if (method.equals(METHOD_PROPFIND)) {
  @@ -1483,7 +1483,7 @@
           }
   
           if (debug > 0)
  -            System.out.println("Dest path :" + destinationPath);
  +            log("Dest path :" + destinationPath);
   
           if ((destinationPath.toUpperCase().startsWith("/WEB-INF")) ||
               (destinationPath.toUpperCase().startsWith("/META-INF"))) {
  @@ -1583,7 +1583,7 @@
                                    String source, String dest) {
   
           if (debug > 1)
  -            System.out.println("Copy: " + source + " To: " + dest);
  +            log("Copy: " + source + " To: " + dest);
   
           Object object = null;
           try {
  @@ -1758,7 +1758,7 @@
                                     String path, Hashtable errorList) {
   
           if (debug > 1)
  -            System.out.println("Delete:" + path);
  +            log("Delete:" + path);
   
           if ((path.toUpperCase().startsWith("/WEB-INF")) ||
               (path.toUpperCase().startsWith("/META-INF"))) {
  
  
  
  1.33      +8 -10     
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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Catalina.java     2 Sep 2004 10:05:00 -0000       1.32
  +++ Catalina.java     16 Sep 2004 23:19:54 -0000      1.33
  @@ -332,7 +332,8 @@
                            new SetParentClassLoaderRule(parentClassLoader));
   
           long t2=System.currentTimeMillis();
  -        log.debug("Digester for server.xml created " + ( t2-t1 ));
  +        if (log.isDebugEnabled())
  +            log.debug("Digester for server.xml created " + ( t2-t1 ));
           return (digester);
   
       }
  @@ -384,8 +385,7 @@
                   digester.parse(is);
                   fis.close();
               } catch (Exception e) {
  -                System.out.println("Catalina.stop: " + e);
  -                e.printStackTrace(System.out);
  +                log.error("Catalina.stop: ", e);
                   System.exit(1);
               }
           }
  @@ -401,8 +401,7 @@
               stream.close();
               socket.close();
           } catch (IOException e) {
  -            System.out.println("Catalina.stop: " + e);
  -            e.printStackTrace(System.out);
  +            log.error("Catalina.stop: ", e);
               System.exit(1);
           }
   
  @@ -464,7 +463,7 @@
           }
   
           if (inputStream == null) {
  -            System.out.println("Can't load server.xml");
  +            log.warn("Can't load server.xml");
               return;
           }
   
  @@ -474,9 +473,8 @@
               digester.parse(inputSource);
               inputStream.close();
           } catch (Exception e) {
  -            System.out.println("Catalina.start using "
  -                               + getConfigFile() + ": " + e);
  -            e.printStackTrace(System.out);
  +            log.warn("Catalina.start using "
  +                               + getConfigFile() + ": " , e);
               return;
           }
   
  
  
  
  1.8       +4 -2      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/CatalinaProperties.java
  
  Index: CatalinaProperties.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/CatalinaProperties.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CatalinaProperties.java   23 Jul 2004 22:42:16 -0000      1.7
  +++ CatalinaProperties.java   16 Sep 2004 23:19:54 -0000      1.8
  @@ -37,6 +37,8 @@
   
       // ------------------------------------------------------- Static Variables
   
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( CatalinaProperties.class );
   
       private static Properties properties = null;
   
  @@ -123,7 +125,7 @@
   
           if ((is == null) || (error != null)) {
               // Do something
  -            System.out.println("Error");
  +            log.warn("Failed to load catalina.properties", error);
           }
   
           // Register the properties as system properties
  
  
  
  1.5       +8 -7      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/ProcessEnvironment.java
  
  Index: ProcessEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/ProcessEnvironment.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProcessEnvironment.java   26 May 2004 16:21:04 -0000      1.4
  +++ ProcessEnvironment.java   16 Sep 2004 23:19:54 -0000      1.5
  @@ -33,6 +33,10 @@
    * @since    Tomcat 4.0
    */
   public class ProcessEnvironment {
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( ProcessEnvironment.class );
  +    
       /** context of the enclosing servlet */
       private ServletContext context = null;
   
  @@ -93,7 +97,9 @@
               setupFromContext(context);
               setupFromRequest(req);
               this.valid = deriveProcessEnvironment(req);
  -            log(this.getClass().getName() + "() ctor, debug level " + debug);
  +            if (log.isDebugEnabled()) 
  +                log.debug(this.getClass().getName() + "() ctor, debug level " + 
  +                          debug);
       }
   
   
  @@ -253,11 +259,6 @@
           String subForBlanks) {
               return (("".equals(couldBeBlank) || couldBeBlank == null) ?
                   subForBlanks : couldBeBlank);
  -    }
  -
  -
  -    protected void log(String s) {
  -        System.out.println(s);
       }
   
   
  
  
  
  1.6       +25 -29    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/ProcessHelper.java
  
  Index: ProcessHelper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/ProcessHelper.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ProcessHelper.java        26 May 2004 16:26:05 -0000      1.5
  +++ ProcessHelper.java        16 Sep 2004 23:19:54 -0000      1.6
  @@ -57,6 +57,9 @@
        */
   public class ProcessHelper {
   
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( ProcessHelper.class );
  +    
       /** script/command to be executed */
       private String command = null;
   
  @@ -243,8 +246,8 @@
                   this.getClass().getName() + ": not ready to run.");
           }
   
  -        if (debug >= 1) {
  -            log("runCGI(envp=[" + env + "], command=" + command + ")");
  +        if (log.isDebugEnabled()) {
  +            log.debug("runCGI(envp=[" + env + "], command=" + command + ")");
           }
   
           if ((command.indexOf(File.separator + "." + File.separator) >= 0)
  @@ -307,14 +310,14 @@
            * Second -- any remaining input
            */
           commandsStdIn = new BufferedOutputStream(proc.getOutputStream());
  -        if (debug >= 2) {
  -            log("runCGI stdin=[" + stdin + "], qs=" + env.get("QUERY_STRING"));
  +        if (log.isDebugEnabled()) {
  +            log.debug("runCGI stdin=[" + stdin + "], qs=" + 
env.get("QUERY_STRING"));
           }
           if ("POST".equals(env.get("REQUEST_METHOD"))) {
  -            if (debug >= 2) {
  -                log("runCGI: writing ---------------\n");
  -                log(postIn);
  -                log(
  +            if (log.isDebugEnabled()) {
  +                log.debug("runCGI: writing ---------------\n");
  +                log.debug(postIn);
  +                log.debug(
                       "runCGI: new content_length="
                           + contentLength
                           + "---------------\n");
  @@ -327,8 +330,8 @@
                * coming...
                */
               if (stdin.available() <= 0) {
  -                if (debug >= 2) {
  -                    log(
  +                if (log.isDebugEnabled()) {
  +                    log.debug(
                           "runCGI stdin is NOT available ["
                               + stdin.available()
                               + "]");
  @@ -339,8 +342,8 @@
                   }
               }
               if (stdin.available() > 0) {
  -                if (debug >= 2) {
  -                    log(
  +                if (log.isDebugEnabled()) {
  +                    log.debug(
                           "runCGI stdin IS available ["
                               + stdin.available()
                               + "]");
  @@ -349,22 +352,19 @@
                   bufRead = -1;
                   try {
                       while ((bufRead = stdin.read(bBuf)) != -1) {
  -                        if (debug >= 2) {
  -                            log(
  +                        if (log.isDebugEnabled()) {
  +                            log.debug(
                                   "runCGI: read ["
                                       + bufRead
                                       + "] bytes from stdin");
                           }
                           commandsStdIn.write(bBuf, 0, bufRead);
                       }
  -                    if (debug >= 2) {
  -                        log("runCGI: DONE READING from stdin");
  +                    if (log.isDebugEnabled()) {
  +                        log.debug("runCGI: DONE READING from stdin");
                       }
                   } catch (IOException ioe) {
  -                    //REMIND: replace with logging
  -                    //REMIND: should I throw this exception?
  -                    log("runCGI: couldn't write all bytes.");
  -                    ioe.printStackTrace();
  +                    log.error("runCGI: couldn't write all bytes.", ioe);
                   }
               }
           }
  @@ -409,8 +409,8 @@
                   String line = null;
                   while (((line = commandsStdOut.readLine()) != null)
                       && !("".equals(line))) {
  -                    if (debug >= 2) {
  -                        log("runCGI: addHeader(\"" + line + "\")");
  +                    if (log.isDebugEnabled()) {
  +                        log.debug("runCGI: addHeader(\"" + line + "\")");
                       }
                       if (line.startsWith("HTTP")) {
                           //TODO: should set status codes (NPH support)
  @@ -428,8 +428,8 @@
                   cBuf = new char[1024];
                   while ((bufRead = commandsStdOut.read(cBuf)) != -1) {
                       if (servletContainerStdout != null) {
  -                        if (debug >= 4) {
  -                            log("runCGI: write(\"" + new String(cBuf) + "\")");
  +                        if (log.isDebugEnabled()) {
  +                            log.debug("runCGI: write(\"" + new String(cBuf) + 
"\")");
                           }
                           servletContainerStdout.write(cBuf, 0, bufRead);
                       }
  @@ -484,10 +484,6 @@
           }
           qs.append(lineSeparator);
           return qs.append(postInput).toString();
  -    }
  -
  -    private void log(String s) {
  -        System.out.println(s);
       }
   
       public int getIClientInputTimeout() {
  
  
  
  1.7       +8 -3      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/StringManager.java
  
  Index: StringManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/StringManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StringManager.java        26 May 2004 16:26:28 -0000      1.6
  +++ StringManager.java        16 Sep 2004 23:19:54 -0000      1.7
  @@ -54,7 +54,10 @@
        */
   
       private ResourceBundle bundle;
  -
  +    
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( StringManager.class );
  +    
       /**
        * Creates a new StringManager for a given package. This is a
        * private method and all access to it is arbitrated by the
  @@ -82,10 +85,12 @@
               if( cl==null )
                   cl=this.getClass().getClassLoader();
   
  -            System.out.println("Can't find resource " + bundleName +
  +            if (log.isDebugEnabled())
  +                log.debug("Can't find resource " + bundleName +
                       " " + cl);
               if( cl instanceof URLClassLoader ) {
  -                System.out.println( ((URLClassLoader)cl).getURLs());
  +                if (log.isDebugEnabled()) 
  +                    log.debug( ((URLClassLoader)cl).getURLs());
               }
           }
       }
  
  
  
  1.7       +6 -5      
jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/WARDirContext.java
  
  Index: WARDirContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/WARDirContext.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WARDirContext.java        16 Jul 2004 17:09:50 -0000      1.6
  +++ WARDirContext.java        16 Sep 2004 23:19:54 -0000      1.7
  @@ -52,7 +52,9 @@
   
   public class WARDirContext extends BaseDirContext {
   
  -
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( WARDirContext.class );
  +    
       // ----------------------------------------------------------- Constructors
   
   
  @@ -152,9 +154,8 @@
               try {
                   base.close();
               } catch (IOException e) {
  -                System.out.println
  -                    ("Exception closing WAR File " + base.getName());
  -                e.printStackTrace(System.out);
  +                log.warn
  +                    ("Exception closing WAR File " + base.getName(), e);
               }
           }
           base = null;
  
  
  

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

Reply via email to