public class FileRotater extends Object
This class implements a flexible log file rotate management system. For a detailed description of how to use this class, please refer to the documentation of the initialize, update and setMode methods.
Note: This class is not guaranteed to be threadsafe.
| Constructor and Description |
|---|
FileRotater()
Creates a new FileRotater instance with a default mode of
FileRotate.None.
|
| Modifier and Type | Method and Description |
|---|---|
FileRotate |
getMode()
Returns the FileRotate mode of this FileRotater object.
|
void |
initialize(Date now)
Initializes this FileRotater object with a user-supplied
timestamp.
|
void |
setMode(FileRotate mode)
Sets the FileRotate mode of this FileRotater object.
|
boolean |
update(Date now)
This method updates the internal date of this FileRotater object and returns
whether the rotate state has changed since the last call to this method or to
initialize.
|
public FileRotater()
public void initialize(Date now)
Always call this method after creating a new FileRotater object and before calling the update method the first time. For additional information please refer to the update method.
now - The user-specified timestamp to use to initialize this object.public boolean update(Date now) throws Exception
now - The timestamp to update this objectException - exceptionpublic FileRotate getMode()
This method returns the current FileRotate mode. For a complete list of available return values, please refer to the FileRotate enum.
public void setMode(FileRotate mode)
Always call the initialize method after changing the log rotate mode to reinitialize this FileRotater object. For a complete list of available file log rotate values, please refer to the FileRotate enum.
mode - The new FileRotate mode.NullPointerException - if the mode argument is null.Copyright © 2023. All rights reserved.