colus       02/02/21 03:54:22

  Modified:    src/java/org/apache/avalon/excalibur/logger/factory
                        FileTargetFactory.java
  Log:
  Support date format rotate stratgey and appendable rotating fiel target.
  
  Revision  Changes    Path
  1.12      +15 -4     
jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java
  
  Index: FileTargetFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FileTargetFactory.java    11 Feb 2002 13:39:35 -0000      1.11
  +++ FileTargetFactory.java    21 Feb 2002 11:54:22 -0000      1.12
  @@ -25,6 +25,7 @@
   import org.apache.log.output.io.rotate.RotatingFileTarget;
   import org.apache.log.output.io.rotate.RotateStrategy;
   import org.apache.log.output.io.rotate.OrRotateStrategy;
  +import org.apache.log.output.io.rotate.RotateStrategyByDate;
   import org.apache.log.output.io.rotate.RotateStrategyBySize;
   import org.apache.log.output.io.rotate.RotateStrategyByTime;
   import org.apache.log.output.io.rotate.FileStrategy;
  @@ -108,10 +109,14 @@
    *   <rotation> element and specify the times (and one size, too) 
inside the
    *   <or> element.
    *  </dd>
  + *  <dt>&lt;date&gt;</dt>
  + *  <dd>
  + *   Rotation occur when string formatted date changed. Specify date 
formatting pattern.
  + *  </dd>
    * </dl>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version CVS $Revision: 1.11 $ $Date: 2002/02/11 13:39:35 $
  + * @version CVS $Revision: 1.12 $ $Date: 2002/02/21 11:54:22 $
    * @since 4.0
    */
   public class FileTargetFactory
  @@ -152,7 +157,7 @@
                   final FileStrategy fileStrategy = getFileStrategy( 
conf_rotation, file );
   
                   logtarget =
  -                    new RotatingFileTarget( formatter, rotateStrategy, 
fileStrategy );
  +                    new RotatingFileTarget( append, formatter, 
rotateStrategy, fileStrategy );
               }
           }
           catch( final IOException ioe )
  @@ -212,6 +217,12 @@
               return new RotateStrategyBySize( size );
           }
   
  +        if ( "date".equals( type ) )
  +        {
  +            final String value = conf.getValue( "yyyyMMdd" );
  +            return new RotateStrategyByDate( value );
  +        }
  +
           // default rotate strategy
           final String value = conf.getValue( "24:00:00" );
   
  @@ -294,7 +305,7 @@
        * Process the file name.
        *
        * This method scans the file name passed for occurrences of
  -     * ${foo}. These strings get replaced by values from the Context 
  +     * ${foo}. These strings get replaced by values from the Context
        * object indexed by the name (here foo).
        *
        * @param rawFilename The filename with substitutable placeholders
  @@ -326,7 +337,7 @@
               }
               catch( final ContextException ce )
               {
  -                throw new ConfigurationException( 
  +                throw new ConfigurationException(
                     "missing entry '" + ctx_name + "' in Context." );
               }
               sb.append( ctx.toString() );
  
  
  

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

Reply via email to