org.log4j.varia
Class ExternallyRolledFileAppender
java.lang.Object
|
+--org.log4j.AppenderSkeleton
|
+--org.log4j.FileAppender
|
+--org.log4j.RollingFileAppender
|
+--org.log4j.varia.ExternallyRolledFileAppender
- All Implemented Interfaces:
- Appender, OptionHandler
- public class ExternallyRolledFileAppender
- extends RollingFileAppender
This appender listen on a socket on the port specified by the
PORT_OPTION
for a "RollOver" message. If and and when such
a message is received, the underlying log file is rolled over and
an acknowledgement message is sent back to the process initiating
the roll over.
Compared to the the ResilientFileAppender
, this method
of triggering roll over has the advantage of being operating system
independent, fast and reliable.
A simple application Roller
is provided to initiate the
roll over.
Note that the intiator is not authenticated. Anyone can trigger
a rollover. In production environments, it is recommended that you
add some form of protection to prevent undesired rollovers.
- Since:
- version 0.9.0
- Author:
- Ceki Gülcü
Field Summary |
static String |
OK
The string constant sent to acknowledge a roll over. |
static String |
PORT_OPTION
A string constant used in naming the option for setting the port
for listening to external roll over messages. |
static String |
ROLL_OVER
The string constant sent to initiate a roll over. |
Methods inherited from class org.log4j.AppenderSkeleton |
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFirstFilter, getName, isAsSevereAsThreshold, setLayout, setName, setThreshold |
PORT_OPTION
public static final String PORT_OPTION
- A string constant used in naming the option for setting the port
for listening to external roll over messages. Current value of
this string constant is Port.
All option keys are case sensitive.
ROLL_OVER
public static final String ROLL_OVER
- The string constant sent to initiate a roll over. Current value of
this string constant is RollOver.
OK
public static final String OK
- The string constant sent to acknowledge a roll over. Current value of
this string constant is OK.
ExternallyRolledFileAppender
public ExternallyRolledFileAppender()
- Thia default constructor does nothing but call its super-class
constructor.
activateOptions
public void activateOptions()
- Start listening on the port specified by a preceding call to
setOption(java.lang.String, java.lang.String)
.
- Overrides:
activateOptions
in class FileAppender
getOptionStrings
public String[] getOptionStrings()
- Retuns the option names for this component, namely
PORT_OPTION
in addition to the options of its super class FileAppender
.
- Overrides:
getOptionStrings
in class RollingFileAppender
setOption
public void setOption(String option,
String value)
- The Port options takes a
- Overrides:
setOption
in class RollingFileAppender
Please notify me about new log4j releases.