ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant Main.java
Date Wed, 12 Jun 2002 15:31:39 GMT
bodewig     2002/06/12 08:31:39

  Modified:    .        Tag: ANT_15_BRANCH WHATSNEW
               src/main/org/apache/tools/ant Tag: ANT_15_BRANCH Main.java
  Log:
  Use logfile only after we are ready printing to System.out
  
  PR: 9796
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.263.2.38 +4 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.263.2.37
  retrieving revision 1.263.2.38
  diff -u -r1.263.2.37 -r1.263.2.38
  --- WHATSNEW	12 Jun 2002 13:46:30 -0000	1.263.2.37
  +++ WHATSNEW	12 Jun 2002 15:31:38 -0000	1.263.2.38
  @@ -13,6 +13,10 @@
   * <pvcs> default filenameformat has been different from Ant 1.4.1.
     Now it is different from 1.5beta1 and 1.5beta2.
   
  +* Some messages that are printed during startup will not be
  +  written to the logfile specified via -logfile as they might destroy
  +  the format of the file for special BuildLoggers (like XmlLogger).
  +
   Fixed bugs:
   -----------
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.65.2.4  +13 -12    jakarta-ant/src/main/org/apache/tools/ant/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
  retrieving revision 1.65.2.3
  retrieving revision 1.65.2.4
  diff -u -r1.65.2.3 -r1.65.2.4
  --- Main.java	9 Jun 2002 08:50:52 -0000	1.65.2.3
  +++ Main.java	12 Jun 2002 15:31:39 -0000	1.65.2.4
  @@ -250,6 +250,7 @@
       protected Main(String[] args) throws BuildException {
   
           String searchForThis = null;
  +        PrintStream logTo = null;
   
           // cycle through given args
   
  @@ -274,10 +275,7 @@
                   try {
                       File logFile = new File(args[i + 1]);
                       i++;
  -                    out = new PrintStream(new FileOutputStream(logFile));
  -                    err = out;
  -                    System.setOut(out);
  -                    System.setErr(out);
  +                    logTo = new PrintStream(new FileOutputStream(logFile));
                       isLogFileUsed = true;
                   } catch (IOException ioe) {
                       String msg = "Cannot write on the specified log file. "
  @@ -436,12 +434,12 @@
                   System.out.println("Could not load property file "
                      + filename + ": " + e.getMessage());
               } finally {
  -                if (fis != null){
  +                if (fis != null) {
                       try {
                           fis.close();
                       } catch (IOException e){
  +                    }
                   }
  -              }
               }
   
               // ensure that -D properties take precedence
  @@ -454,6 +452,15 @@
               }
           }
   
  +        if (msgOutputLevel >= Project.MSG_INFO) {
  +            System.out.println("Buildfile: " + buildFile);
  +        }
  +
  +        if (logTo != null) {
  +            out = err = logTo;
  +            System.setOut(out);
  +            System.setErr(out);
  +        }
           readyToRun = true;
       }
   
  @@ -536,12 +543,6 @@
   
           if (!readyToRun) {
               return;
  -        }
  -
  -        // track when we started
  -
  -        if (msgOutputLevel >= Project.MSG_INFO) {
  -            System.out.println("Buildfile: " + buildFile);
           }
   
           final Project project = new Project();
  
  
  

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


Mime
View raw message