org.apache.log.output.io.rotate
public class RevolvingFileStrategy extends Object implements FileStrategy
Modifier and Type | Field and Description |
---|---|
private File |
m_baseFile |
private DecimalFormat |
m_decimalFormat |
private int |
m_maxRotations |
private int |
m_rotation |
private static String |
PATTERN |
Constructor and Description |
---|
RevolvingFileStrategy(File baseFile,
int maxRotations)
Creation of a new instane ofthe revolving file strategy.
|
RevolvingFileStrategy(File baseFile,
int initialRotation,
int maxRotations)
Creation of a new instane ofthe revolving file strategy.
|
Modifier and Type | Method and Description |
---|---|
private int |
calculateInitialRotation()
Method that searches through files that
match the pattern for resolving file and determine
the last generation written to.
|
private int |
calculateRotationForFile(File file)
Return the rotation for the specified file
|
private int[] |
calculateRotations(File[] matchingFiles)
Generate an array of rotation numbers for all the files specified.
|
int |
getCurrentRotation()
Retrieve the current rotation number.
|
private File[] |
getMatchingFiles()
Get a list of files that could have been part of the rotation.
|
File |
nextFile()
Calculate the real file name from the base filename.
|
private static final String PATTERN
private DecimalFormat m_decimalFormat
private int m_rotation
private int m_maxRotations
private File m_baseFile
public RevolvingFileStrategy(File baseFile, int maxRotations)
baseFile
- the base filemaxRotations
- the maximum number of rotations ??public RevolvingFileStrategy(File baseFile, int initialRotation, int maxRotations)
baseFile
- the base fileinitialRotation
- the number of initial rotations ??maxRotations
- the maximum number of rotations??public File nextFile()
nextFile
in interface FileStrategy
public int getCurrentRotation()
private int calculateInitialRotation()
private int[] calculateRotations(File[] matchingFiles)
matchingFiles
- the files to generate rotation numbers forprivate int calculateRotationForFile(File file)
file
- the file to checkprivate File[] getMatchingFiles()
Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.