java.io.Closeable
, java.io.Flushable
, java.lang.AutoCloseable
, FlushableCloseable
, Protectable
PeriodicSizeRotatingFileHandler
public class PeriodicRotatingFileHandler extends FileHandler
setSuffix(String)
.Modifier and Type | Class | Description |
---|---|---|
static class |
PeriodicRotatingFileHandler.Period |
Possible period values.
|
handlers, handlersUpdater
outputLock
Constructor | 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 | Description |
---|---|---|
protected java.lang.String |
getNextSuffix() |
Returns the suffix to be used.
|
java.util.TimeZone |
getTimeZone() |
Get the configured time zone for this handler.
|
protected void |
preWrite(ExtLogRecord record) |
Execute any pre-write policy, such as file rotation.
|
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.
|
addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isCallerCalculationRequired, isCloseChildren, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setCloseChildren, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotect
getFile, setAppend, setFileName
getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEncoding, setEncoding, setOutputStream, setWriter
close, doPublish, flush, safeClose
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
FileHandler
setFile
in class FileHandler
file
- the filejava.io.FileNotFoundException
- if an error occurs opening the fileprotected void preWrite(ExtLogRecord record)
preWrite
in class WriterHandler
record
- 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.
If the suffix ends with .gz
or .zip
the file will be compressed on rotation.
suffix
- the suffixjava.lang.IllegalArgumentException
- if the suffix is not validprotected final java.lang.String getNextSuffix()
public java.util.TimeZone getTimeZone()
public void setTimeZone(java.util.TimeZone timeZone)
timeZone
- the configured time zoneCopyright © 2018. All rights reserved.