public class PeriodicRotatingFileHandler extends FileHandler
setSuffix(String).| Modifier and Type | Class and Description |
|---|---|
static class |
PeriodicRotatingFileHandler.Period
Possible period values.
|
| Modifier and Type | Field and Description |
|---|---|
private java.text.SimpleDateFormat |
format |
private long |
nextRollover |
private java.lang.String |
nextSuffix |
private PeriodicRotatingFileHandler.Period |
period |
private java.util.TimeZone |
timeZone |
outputLockhandlers, handlersUpdater| Constructor and Description |
|---|
PeriodicRotatingFileHandler()
Construct a new instance with no formatter and no output file.
|
PeriodicRotatingFileHandler(java.io.File file,
java.lang.String suffix)
Construct a new instance with the given output file.
|
PeriodicRotatingFileHandler(java.io.File file,
java.lang.String suffix,
boolean append)
Construct a new instance with the given output file and append setting.
|
PeriodicRotatingFileHandler(java.lang.String fileName)
Construct a new instance with the given output file.
|
PeriodicRotatingFileHandler(java.lang.String fileName,
boolean append)
Construct a new instance with the given output file and append setting.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
calcNextRollover(long fromTime) |
protected java.lang.String |
getNextSuffix()
Returns the suffix to be used.
|
java.util.TimeZone |
getTimeZone()
Get the configured time zone for this handler.
|
private static <T extends java.lang.Comparable<? super T>> |
min(T a,
T b) |
protected void |
preWrite(ExtLogRecord record)
Execute any pre-write policy, such as file rotation.
|
private void |
rollOver() |
void |
setFile(java.io.File file)
Set the output file.
|
void |
setSuffix(java.lang.String suffix)
Set the suffix string.
|
void |
setTimeZone(java.util.TimeZone timeZone)
Set the configured time zone for this handler.
|
getFile, setAppend, setFileNamegetEncoding, setEncoding, setOutputStream, setWriterclose, doPublish, flush, safeCloseaddHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotectprivate java.text.SimpleDateFormat format
private java.lang.String nextSuffix
private PeriodicRotatingFileHandler.Period period
private long nextRollover
private java.util.TimeZone timeZone
public PeriodicRotatingFileHandler()
public PeriodicRotatingFileHandler(java.lang.String fileName)
throws java.io.FileNotFoundException
fileName - the file namejava.io.FileNotFoundException - if the file could not be found on openpublic PeriodicRotatingFileHandler(java.lang.String fileName,
boolean append)
throws java.io.FileNotFoundException
fileName - the file nameappend - true to append, false to overwritejava.io.FileNotFoundException - if the file could not be found on openpublic PeriodicRotatingFileHandler(java.io.File file,
java.lang.String suffix)
throws java.io.FileNotFoundException
file - the filesuffix - the format suffix to usejava.io.FileNotFoundException - if the file could not be found on openpublic PeriodicRotatingFileHandler(java.io.File file,
java.lang.String suffix,
boolean append)
throws java.io.FileNotFoundException
file - the filesuffix - the format suffix to useappend - true to append, false to overwritejava.io.FileNotFoundException - if the file could not be found on openpublic void setFile(java.io.File file)
throws java.io.FileNotFoundException
FileHandlersetFile in class FileHandlerfile - the filejava.io.FileNotFoundException - if an error occurs opening the fileprotected void preWrite(ExtLogRecord record)
preWrite in class WriterHandlerrecord - the record about to be loggedpublic void setSuffix(java.lang.String suffix)
throws java.lang.IllegalArgumentException
SimpleDateFormat.
The period of the rotation is automatically calculated based on the suffix.suffix - the suffixjava.lang.IllegalArgumentException - if the suffix is not validprotected final java.lang.String getNextSuffix()
private void rollOver()
private void calcNextRollover(long fromTime)
public java.util.TimeZone getTimeZone()
public void setTimeZone(java.util.TimeZone timeZone)
timeZone - the configured time zoneprivate static <T extends java.lang.Comparable<? super T>> T min(T a,
T b)