public class RollingResourceAppender extends ResourceAppender
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_BACKUP_INDEX |
static long |
DEFAULT_MAX_FILE_SIZE |
Constructor and Description |
---|
RollingResourceAppender(org.apache.log4j.Layout layout,
Resource res,
Charset charset,
boolean append,
long maxFileSize,
int maxBackupIndex,
int timeout,
RetireListener listener)
Instantiate a RollingFileAppender and open the file designated by
filename . |
RollingResourceAppender(org.apache.log4j.Layout layout,
Resource res,
Charset charset,
boolean append,
RetireListener listener)
Instantiate a RollingFileAppender and open the file designated by
filename . |
RollingResourceAppender(org.apache.log4j.Layout layout,
Resource res,
Charset charset,
RetireListener listener)
Instantiate a FileAppender and open the file designated by
filename . |
Modifier and Type | Method and Description |
---|---|
int |
getMaxBackupIndex()
Returns the value of the MaxBackupIndex option.
|
long |
getMaximumFileSize()
Get the maximum size that the output file is allowed to reach
before being rolled over to backup files.
|
void |
rollOver()
Implements the usual roll over behaviour.
|
void |
setFile(boolean append)
Sets and opens the file where the log output will
go.
|
void |
setMaxBackupIndex(int maxBackups)
Set the maximum number of backup files to keep around.
|
getAppend, getBufferedIO, getBufferSize, getResource, isClosed
activateOptions, append, close, getEncoding, getImmediateFlush, requiresLayout, setEncoding, setErrorHandler, setImmediateFlush, setWriter
public static final long DEFAULT_MAX_FILE_SIZE
public static final int DEFAULT_MAX_BACKUP_INDEX
public RollingResourceAppender(org.apache.log4j.Layout layout, Resource res, Charset charset, RetireListener listener) throws IOException
filename
. The opened filename will become the output
destination for this appender.
The file will be appended to.
IOException
public RollingResourceAppender(org.apache.log4j.Layout layout, Resource res, Charset charset, boolean append, RetireListener listener) throws IOException
filename
. The opened filename will become the ouput
destination for this appender.
If the append
parameter is true, the file will be
appended to. Otherwise, the file desginated by
filename
will be truncated before being opened.
IOException
public RollingResourceAppender(org.apache.log4j.Layout layout, Resource res, Charset charset, boolean append, long maxFileSize, int maxBackupIndex, int timeout, RetireListener listener) throws IOException
filename
. The opened filename will become the ouput
destination for this appender.
If the append
parameter is true, the file will be
appended to. Otherwise, the file desginated by
filename
will be truncated before being opened.
IOException
public int getMaxBackupIndex()
public long getMaximumFileSize()
public void rollOver()
If MaxBackupIndex
is positive, then files
{File.1
, ..., File.MaxBackupIndex -1
}
are renamed to {File.2
, ...,
File.MaxBackupIndex
}. Moreover, File
is
renamed File.1
and closed. A new File
is
created to receive further log output.
If MaxBackupIndex
is equal to zero, then the
File
is truncated with no backup files created.
public void setFile(boolean append) throws IOException
ResourceAppender
Sets and opens the file where the log output will go. The specified file must be writable.
If there was already an opened file, then the previous file is closed first.
Do not use this method directly. To configure a FileAppender or one of its subclasses, set its properties one by one and then call activateOptions.
append
- If true will append to fileName. Otherwise will
truncate fileName.IOException
public void setMaxBackupIndex(int maxBackups)
The MaxBackupIndex option determines how many backup
files are kept before the oldest is erased. This option takes
a positive integer value. If set to zero, then there will be no
backup files and the log file will be truncated when it reaches
MaxFileSize
.
Copyright © 2015 Lucee