Package org.apache.log.output.io.rotate
Class UniqueFileStrategy
- java.lang.Object
-
- org.apache.log.output.io.rotate.UniqueFileStrategy
-
- All Implemented Interfaces:
FileStrategy
public class UniqueFileStrategy extends java.lang.Object implements FileStrategy
Strategy for naming log files based on appending time suffix. A file name can be based on simply appending the number of miliseconds since (not really sure) 1/1/1970. Other constructors accept a pattern of aSimpleDateFormatto form the appended string to the base file name as well as a suffix which should be appended last. Anew UniqueFileStrategy( new File( "foo." ), "yyyy-MM-dd", ".log" )object will returnFileobjects with file names likefoo.2001-12-24.log- Author:
- Bernhard Huber, Giacomo Pati
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Filem_baseFileprivate java.text.SimpleDateFormatm_formatterprivate java.lang.Stringm_suffix
-
Constructor Summary
Constructors Constructor Description UniqueFileStrategy(java.io.File baseFile)Creation of a new Unique File Strategy ??UniqueFileStrategy(java.io.File baseFile, java.lang.String pattern)Creation of a new Unique File Strategy ??UniqueFileStrategy(java.io.File baseFile, java.lang.String pattern, java.lang.String suffix)Creation of a new Unique File Strategy ??
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilenextFile()Calculate the real file name from the base filename.
-
-
-
Constructor Detail
-
UniqueFileStrategy
public UniqueFileStrategy(java.io.File baseFile)
Creation of a new Unique File Strategy ??- Parameters:
baseFile- the base file
-
UniqueFileStrategy
public UniqueFileStrategy(java.io.File baseFile, java.lang.String pattern)Creation of a new Unique File Strategy ??- Parameters:
baseFile- the base filepattern- the format pattern
-
UniqueFileStrategy
public UniqueFileStrategy(java.io.File baseFile, java.lang.String pattern, java.lang.String suffix)Creation of a new Unique File Strategy ??- Parameters:
baseFile- the base filepattern- the format patternsuffix- the suffix ??
-
-
Method Detail
-
nextFile
public java.io.File nextFile()
Calculate the real file name from the base filename.- Specified by:
nextFilein interfaceFileStrategy- Returns:
- File the calculated file name
-
-