public class SizeRotatingFileHandler extends FileHandler
outputLockhandlers, handlersUpdater| Constructor and Description |
|---|
SizeRotatingFileHandler()
Construct a new instance with no formatter and no output file.
|
SizeRotatingFileHandler(File file)
Construct a new instance with the given output file.
|
SizeRotatingFileHandler(File file,
boolean append)
Construct a new instance with the given output file and append setting.
|
SizeRotatingFileHandler(File file,
boolean append,
long rotateSize,
int maxBackupIndex)
Construct a new instance with the given output file and append setting.
|
SizeRotatingFileHandler(File file,
long rotateSize,
int maxBackupIndex)
Construct a new instance with the given output file.
|
SizeRotatingFileHandler(long rotateSize,
int maxBackupIndex)
Construct a new instance with no formatter and no output file.
|
SizeRotatingFileHandler(String fileName)
Construct a new instance with the given output file.
|
SizeRotatingFileHandler(String fileName,
boolean append)
Construct a new instance with the given output file and append setting.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getSuffix()
Returns the suffix set to be appended to files during rotation.
|
boolean |
isRotateOnBoot()
Indicates whether or a not the handler should rotate the file before the first log record is written.
|
protected void |
preWrite(ExtLogRecord record)
Execute any pre-write policy, such as file rotation.
|
void |
setFile(File file)
Set the output file.
|
void |
setMaxBackupIndex(int maxBackupIndex)
Set the maximum backup index (the number of log files to keep around).
|
void |
setOutputStream(OutputStream outputStream)
Set the output stream to write to.
|
void |
setRotateOnBoot(boolean rotateOnBoot)
Set to a value of
true if the file should be rotated before the a new file is set. |
void |
setRotateSize(long rotateSize)
Set the rotation size, in bytes.
|
void |
setSuffix(String suffix)
Sets the suffix to be appended to the file name during the file rotation.
|
getFile, setAppend, setFileNamegetEncoding, setEncoding, setWriterclose, doPublish, flush, safeCloseaddHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotectgetErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportErrorpublic SizeRotatingFileHandler()
public SizeRotatingFileHandler(File file) throws FileNotFoundException
file - the fileFileNotFoundException - if the file could not be found on openpublic SizeRotatingFileHandler(File file, boolean append) throws FileNotFoundException
file - the fileappend - true to append, false to overwriteFileNotFoundException - if the file could not be found on openpublic SizeRotatingFileHandler(String fileName) throws FileNotFoundException
fileName - the file nameFileNotFoundException - if the file could not be found on openpublic SizeRotatingFileHandler(String fileName, boolean append) throws FileNotFoundException
fileName - the file nameappend - true to append, false to overwriteFileNotFoundException - if the file could not be found on openpublic SizeRotatingFileHandler(long rotateSize,
int maxBackupIndex)
public SizeRotatingFileHandler(File file, long rotateSize, int maxBackupIndex) throws FileNotFoundException
file - the fileFileNotFoundException - if the file could not be found on openpublic SizeRotatingFileHandler(File file, boolean append, long rotateSize, int maxBackupIndex) throws FileNotFoundException
file - the fileappend - true to append, false to overwriteFileNotFoundException - if the file could not be found on openpublic void setOutputStream(OutputStream outputStream)
setOutputStream in class OutputStreamHandleroutputStream - the new output stream or null for nonepublic void setFile(File file) throws FileNotFoundException
setFile in class FileHandlerfile - the fileRuntimeException - if there is an attempt to rotate file and the rotation failsFileNotFoundException - if an error occurs opening the filepublic boolean isRotateOnBoot()
true if file should rotate on boot, otherwise false/public void setRotateOnBoot(boolean rotateOnBoot)
true if the file should be rotated before the a new file is set. The rotation only
happens if the file names are the same and the file has a length greater than 0.rotateOnBoot - true to rotate on boot, otherwise falsepublic void setRotateSize(long rotateSize)
rotateSize - the number of bytes before the log is rotatedpublic void setMaxBackupIndex(int maxBackupIndex)
maxBackupIndex - the maximum backup indexpublic String getSuffix()
null if no suffix should be usedpublic void setSuffix(String suffix)
SimpleDateFormat.
Note: Any files rotated with the suffix appended will not be deleted. The maxBackupIndex is not used for files with a suffix.suffix - the suffix to place after the filename when the file is rotatedprotected void preWrite(ExtLogRecord record)
preWrite in class WriterHandlerrecord - the record about to be loggedCopyright © 2017 JBoss by Red Hat. All rights reserved.