|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.log.output.io.rotate.RevolvingFileStrategy
strategy for naming log files based on appending revolving suffix. If the initial rotation is not specified then the class will attempt to calculate the rotation number via the following algorithm. It will search for the file with the highest number in the rotation. It will then increment its rotation number and use that number. If all files in rotation are present then it will then set the initial rotation to the next rotation after the most recently created file.
Field Summary | |
private java.io.File |
m_baseFile
|
private java.text.DecimalFormat |
m_decimalFormat
|
private int |
m_maxRotations
|
private int |
m_rotation
|
private static java.lang.String |
PATTERN
|
Constructor Summary | |
RevolvingFileStrategy(java.io.File baseFile,
int maxRotations)
Creation of a new instane ofthe revolving file strategy. |
|
RevolvingFileStrategy(java.io.File baseFile,
int initialRotation,
int maxRotations)
Creation of a new instane ofthe revolving file strategy. |
Method Summary | |
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(java.io.File file)
Return the rotation for the specified file |
private int[] |
calculateRotations(java.io.File[] matchingFiles)
Generate an array of rotation numbers for all the files specified. |
int |
getCurrentRotation()
Retrieve the current rotation number. |
private java.io.File[] |
getMatchingFiles()
Get a list of files that could have been part of the rotation. |
java.io.File |
nextFile()
Calculate the real file name from the base filename. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String PATTERN
private java.text.DecimalFormat m_decimalFormat
private int m_rotation
private int m_maxRotations
private java.io.File m_baseFile
Constructor Detail |
public RevolvingFileStrategy(java.io.File baseFile, int maxRotations)
baseFile
- the base filemaxRotations
- the maximum number of rotations ??public RevolvingFileStrategy(java.io.File baseFile, int initialRotation, int maxRotations)
baseFile
- the base fileinitialRotation
- the number of initial rotations ??maxRotations
- the maximum number of rotations??Method Detail |
public java.io.File nextFile()
nextFile
in interface FileStrategy
public int getCurrentRotation()
private int calculateInitialRotation()
private int[] calculateRotations(java.io.File[] matchingFiles)
matchingFiles
- the files to generate rotation numbers for
private int calculateRotationForFile(java.io.File file)
file
- the file to check
private java.io.File[] getMatchingFiles()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |