When rolling over, FixedWindowRollingPolicy
renames files according to a fixed window algorithm as described below.
More...
Inherits log4cxx::rolling::RollingPolicyBase.
List of all members.
Detailed Description
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" somwhere 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.
Constructor & Destructor Documentation
Member Function Documentation
int getMaxIndex |
( |
|
) |
const |
int getMinIndex |
( |
|
) |
const |
Initialize the policy and return any initial actions for rolling file appender.
- Parameters:
-
- Returns:
- Description of the initialization, may be null to indicate no initialization needed.
- Exceptions:
-
| SecurityException | if denied access to log files. |
Prepare for a rollover.
This method is called prior to closing the active log file, performs any necessary preliminary actions and describes actions needed after close of current log file.
- Parameters:
-
| activeFile | file name for current active log file. |
| p | pool used for any required memory allocations. |
- Returns:
- Description of pending rollover, may be null to indicate no rollover at this time.
- Exceptions:
-
| SecurityException | if denied access to log files. |
void setMaxIndex |
( |
int |
newVal |
) |
|
void setMinIndex |
( |
int |
newVal |
) |
|
The documentation for this class was generated from the following file: