|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy
public class DefaultRolloverStrategy
When rolling over, FixedWindowRollingPolicy
renames files
according to a fixed window algorithm as described below.
The ActiveFileName property, which is required, represents the name of the file where current logging output will be written. The FileNamePattern option represents the file name pattern for the archived (rolled over) log files. If present, the FileNamePattern option must include an integer token, that is the string "%i" somewhere within the pattern.
Let max and min represent the values of respectively
the MaxIndex and MinIndex options. Let "foo.log" be the value
of the ActiveFile option and "foo.%i.log" the value of
FileNamePattern. Then, when rolling over, the file
foo.max.log
will be deleted, the file
foo.max-1.log
will be renamed as
foo.max.log
, the file foo.max-2.log
renamed as foo.max-1.log
, and so on,
the file foo.min+1.log
renamed as
foo.min+2.log
. Lastly, the active file foo.log
will be renamed as foo.min.log
and a new active file name
foo.log
will be created.
Given that this rollover algorithm requires as many file renaming operations as the window size, large window sizes are discouraged. The current implementation will automatically reduce the window size to 12 when larger values are specified by the user.
Field Summary | |
---|---|
protected static org.apache.logging.log4j.Logger |
LOGGER
Allow subclasses access to the status logger without creating another instance. |
Constructor Summary | |
---|---|
protected |
DefaultRolloverStrategy(int min,
int max,
StrSubstitutor subst)
Constructs a new instance. |
Method Summary | |
---|---|
static DefaultRolloverStrategy |
createStrategy(String max,
String min,
Configuration config)
Create the DefaultRolloverStrategy. |
RolloverDescription |
rollover(RollingFileManager manager)
Perform the rollover. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.logging.log4j.Logger LOGGER
Constructor Detail |
---|
protected DefaultRolloverStrategy(int min, int max, StrSubstitutor subst)
min
- The minimum index.max
- The maximum index.Method Detail |
---|
public RolloverDescription rollover(RollingFileManager manager) throws SecurityException
rollover
in interface RolloverStrategy
manager
- The RollingFileManager name for current active log file.
SecurityException
- if an error occurs.public String toString()
toString
in class Object
public static DefaultRolloverStrategy createStrategy(String max, String min, Configuration config)
max
- The maximum number of files to keep.min
- The minimum number of files to keep.config
- The Configuration.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |