You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by gi...@apache.org on 2001/12/14 09:35:16 UTC

cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/logger/factory FileTargetFactory.java

giacomo     01/12/14 00:35:16

  Modified:    src/java/org/apache/avalon/excalibur/logger/factory
                        FileTargetFactory.java
  Log:
  changed FileTargetFactory to take advantage of the new UniqueFileStrategy from logkit
  
  Revision  Changes    Path
  1.7       +24 -2     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FileTargetFactory.java	2001/12/11 09:53:30	1.6
  +++ FileTargetFactory.java	2001/12/14 08:35:16	1.7
  @@ -46,7 +46,11 @@
    *  <filename>${context-key}/real-name/...</filename>
    *  <format type="raw|pattern|extended">pattern to be used if needed</format>
    *  <append>true|false</append>
  - *  <rotation type="revolving|unique" init="5" max="10">
  + *  <rotation type="revolving" init="5" max="10">
  + *
  + * or
  + *
  + *  <rotation type="unique" pattern="yyyy-MM-dd-hh-mm-ss" suffix=".log">
    *   <or>
    *    <size>10000000</size>
    *    <time>24:00:00</time>
  @@ -86,6 +90,8 @@
    *   (revolving=RevolvingFileStrategy, unique=UniqueFileStrategy).
    *   The required init and max attribute are used to determine the initial and 
    *   maximum rotation to use on a type="revolving" attribute. 
  + *   The optional pattern and suffix attribute are used to form filenames on
  + *   a type="unique" attribute.
    *  </dd>
    *  <dt>&lt;or&gt;</dt>
    *  <dd>uses the OrRotateStrategy to combine the children</dd>
  @@ -105,7 +111,7 @@
    * </dl>
    *
    * @author <a href="mailto:giacomo@apache,org">Giacomo Pati</a>
  - * @version CVS $Revision: 1.6 $ $Date: 2001/12/11 09:53:30 $
  + * @version CVS $Revision: 1.7 $ $Date: 2001/12/14 08:35:16 $
    * @since 4.0
    */
   public class FileTargetFactory 
  @@ -255,7 +261,23 @@
           }
           
           // default file strategy
  -        return new UniqueFileStrategy( file );
  +        final String pattern = conf.getAttribute( "pattern", null ); 
  +        final String suffix =  conf.getAttribute( "suffix", null ); 
  +        if( pattern == null)
  +        {
  +            return new UniqueFileStrategy( file );
  +        } 
  +        else 
  +        {
  +            if( suffix == null ) 
  +            {
  +                return new UniqueFileStrategy( file, pattern );
  +            } 
  +            else 
  +            {
  +                return new UniqueFileStrategy( file, pattern, suffix );
  +            }
  +        } 
       }    
   
       protected Formatter getFormatter(final Configuration conf) 
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>