java.lang.Object | ||||
↳ | org.apache.log4j.AppenderSkeleton | |||
↳ | org.apache.log4j.WriterAppender | |||
↳ | org.apache.log4j.FileAppender | |||
↳ | org.apache.log4j.RollingFileAppender |
Known Direct Subclasses |
RollingFileAppender extends FileAppender to backup the log files when they reach a certain size. The log4j extras companion includes alternatives which should be considered for new deployments and which are discussed in the documentation for org.apache.log4j.rolling.RollingFileAppender.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
maxBackupIndex | There is one backup file by default. | ||||||||||
maxFileSize | The default maximum file size is 10MB. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.log4j.FileAppender
| |||||||||||
From class
org.apache.log4j.WriterAppender
| |||||||||||
From class
org.apache.log4j.AppenderSkeleton
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
The default constructor simply calls its
parents constructor . | |||||||||||
Instantiate a RollingFileAppender and open the file designated by
filename . | |||||||||||
Instantiate a FileAppender and open the file designated by
filename . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the value of the MaxBackupIndex option.
| |||||||||||
Get the maximum size that the output file is allowed to reach
before being rolled over to backup files.
| |||||||||||
Implements the usual roll over behaviour.
| |||||||||||
Sets and opens the file where the log output will go. | |||||||||||
Set the maximum number of backup files to keep around.
| |||||||||||
Set the maximum size that the output file is allowed to reach
before being rolled over to backup files.
| |||||||||||
Set the maximum size that the output file is allowed to reach
before being rolled over to backup files.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Sets the quiet writer being used.
| |||||||||||
This method differentiates RollingFileAppender from its super
class.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.log4j.FileAppender
| |||||||||||
From class
org.apache.log4j.WriterAppender
| |||||||||||
From class
org.apache.log4j.AppenderSkeleton
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.apache.log4j.Appender
| |||||||||||
From interface
org.apache.log4j.spi.OptionHandler
|
There is one backup file by default.
The default maximum file size is 10MB.
Instantiate a RollingFileAppender and open the file designated by
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 |
---|
Instantiate a FileAppender and open the file designated by
filename
. The opened filename will become the output
destination for this appender.
The file will be appended to.
IOException |
---|
Returns the value of the MaxBackupIndex option.
Get the maximum size that the output file is allowed to reach before being rolled over to backup files.
Implements the usual roll over behaviour.
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.
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.
fileName | The path to the log file. |
---|---|
append | If true will append to fileName. Otherwise will truncate fileName. |
IOException |
---|
Set the maximum number of backup files to keep around.
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
.
Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
In configuration files, the MaxFileSize option takes an long integer in the range 0 - 2^63. You can specify the value with the suffixes "KB", "MB" or "GB" so that the integer is interpreted being expressed respectively in kilobytes, megabytes or gigabytes. For example, the value "10KB" will be interpreted as 10240.
Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
This method is equivalent to setMaxFileSize(String)
except
that it is required for differentiating the setter taking a
long
argument from the setter taking a
String
argument by the JavaBeans java.beans.Introspector Introspector.
Sets the quiet writer being used.
This method is overriden by RollingFileAppender
.
This method differentiates RollingFileAppender from its super class.