cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/transformation LogTransformer.java
Date Mon, 11 Feb 2002 13:29:23 GMT
cziegeler    02/02/11 05:29:23

  Modified:    src/java/org/apache/cocoon/environment/wrapper
                        EnvironmentWrapper.java
               src/java/org/apache/cocoon/transformation
                        LogTransformer.java
  Log:
  Fixed LogTransformer: the standard output stream is not closed anymore
  
  Revision  Changes    Path
  1.7       +2 -1      xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
  
  Index: EnvironmentWrapper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EnvironmentWrapper.java	7 Feb 2002 08:59:17 -0000	1.6
  +++ EnvironmentWrapper.java	11 Feb 2002 13:29:23 -0000	1.7
  @@ -77,7 +77,7 @@
    * contains a <code>RequestWrapper</code> object.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version $Id: EnvironmentWrapper.java,v 1.6 2002/02/07 08:59:17 cziegeler Exp $
  + * @version $Id: EnvironmentWrapper.java,v 1.7 2002/02/11 13:29:23 cziegeler Exp $
    */
   public final class EnvironmentWrapper
   extends AbstractEnvironment
  @@ -136,6 +136,7 @@
           this.request = new RequestWrapper(ObjectModelHelper.getRequest(oldObjectModel),
                                                    requestURI, queryString, this);
           this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, this.request);
  +
           this.objectModel.put("Internal-Request", "true");
       }
   
  
  
  
  1.6       +10 -7     xml-cocoon2/src/java/org/apache/cocoon/transformation/LogTransformer.java
  
  Index: LogTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/LogTransformer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LogTransformer.java	5 Feb 2002 11:39:30 -0000	1.5
  +++ LogTransformer.java	11 Feb 2002 13:29:23 -0000	1.6
  @@ -92,7 +92,7 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @author <a href="mailto:giacomo.pati@pwr.ch">Giacomo Pati</a>
    *         (PWR Organisation &amp; Entwicklung)
  - * @version CVS $Id: LogTransformer.java,v 1.5 2002/02/05 11:39:30 cziegeler Exp $
  + * @version CVS $Id: LogTransformer.java,v 1.6 2002/02/11 13:29:23 cziegeler Exp $
    *
    */
   public class LogTransformer
  @@ -113,6 +113,7 @@
           final String  logfilename = parameters.getParameter("logfile", null);
   
           // Check for null, use System.out if logfile is not specified.
  +        this.logfile = null;
           if ( null != logfilename ) {
               Source source = null;
               try {
  @@ -126,8 +127,6 @@
               } finally {
                   if (source != null) source.recycle();
               }
  -        } else {
  -            this.logfile = new FileWriter(java.io.FileDescriptor.out);
           }
   
           Date date = new Date();
  @@ -361,7 +360,7 @@
        * Report to logfile.
        */
       private void log (String location, String description) {
  -        StringBuffer logEntry = new StringBuffer();
  +        final StringBuffer logEntry = new StringBuffer();
           logEntry.append ( "[" );
           logEntry.append ( location );
           logEntry.append ( "] " );
  @@ -369,11 +368,15 @@
           logEntry.append ( lf );
           final String text = logEntry.toString();
           if ( this.getLogger().isInfoEnabled() ) {
  -            getLogger().info( text );
  +            this.getLogger().info( text );
           }
           try {
  -            logfile.write( text, 0, text.length());
  -            logfile.flush();
  +            if ( null != this.logfile ) {
  +                this.logfile.write( text, 0, text.length());
  +                this.logfile.flush();
  +            } else {
  +                System.out.println( text );
  +            }
           }
           catch(IOException ioe) {
               this.getLogger().debug("LogTransformer.log", ioe);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message