Log4j 1.1.3

org.apache.log4j.varia
Class ExternallyRolledFileAppender

java.lang.Object
  |
  +--org.apache.log4j.AppenderSkeleton
        |
        +--org.apache.log4j.WriterAppender
              |
              +--org.apache.log4j.FileAppender
                    |
                    +--org.apache.log4j.RollingFileAppender
                          |
                          +--org.apache.log4j.varia.ExternallyRolledFileAppender
All Implemented Interfaces:
Appender, OptionHandler

public class ExternallyRolledFileAppender
extends RollingFileAppender

This appender listens on a socket on the port specified by the PORT_OPTION for a "RollOver" message. When such a message is received, the underlying log file is rolled over and an acknowledgment message is sent back to the process initiating the roll over.

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 initiator 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
          Deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.
static String ROLL_OVER
          The string constant sent to initiate a roll over.
 
Fields inherited from class org.apache.log4j.RollingFileAppender
MAX_BACKUP_INDEX_OPTION, MAX_FILE_SIZE_OPTION, maxBackupIndex, maxFileSize
 
Fields inherited from class org.apache.log4j.FileAppender
APPEND_OPTION, FILE_OPTION, fileAppend, fileName, qwIsOurs
 
Fields inherited from class org.apache.log4j.WriterAppender
IMMEDIATE_FLUSH_OPTION, immediateFlush, qw
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold, THRESHOLD_OPTION
 
Constructor Summary
ExternallyRolledFileAppender()
          The default constructor does nothing but calls its super-class constructor.
 
Method Summary
 void activateOptions()
          Start listening on the port specified by a preceding call to setOption(java.lang.String, java.lang.String).
 String[] getOptionStrings()
          Deprecated. We now use JavaBeans introspection to configure components. Options strings are no longer needed.
 int getPort()
          Returns value of the Port option.
 void setOption(String option, String value)
          Deprecated. Use the setter method for the option directly instead of the generic setOption method.
 void setPort(int port)
          The Port option is used for setting the port for listening to external roll over messages.
 
Methods inherited from class org.apache.log4j.RollingFileAppender
getMaxBackupIndex, getMaximumFileSize, rollOver, setFile, setMaxBackupIndex, setMaxFileSize, setMaxFileSize, setMaximumFileSize, setQWForFiles, subAppend
 
Methods inherited from class org.apache.log4j.FileAppender
closeFile, getAppend, getFile, reset, setAppend, setFile
 
Methods inherited from class org.apache.log4j.WriterAppender
append, checkEntryConditions, close, closeWriter, getImmediateFlush, requiresLayout, setErrorHandler, setImmediateFlush, setWriter, writeFooter, writeHeader
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORT_OPTION

public static final String PORT_OPTION
Deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

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.
Constructor Detail

ExternallyRolledFileAppender

public ExternallyRolledFileAppender()
The default constructor does nothing but calls its super-class constructor.
Method Detail

getOptionStrings

public String[] getOptionStrings()
Deprecated. We now use JavaBeans introspection to configure components. Options strings are no longer needed.

Returns 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)
Deprecated. Use the setter method for the option directly instead of the generic setOption method.

Set ExternallyRolledFileAppender specific options. In addition to FileAppender options and RollingFileAppender options, ExternallyRolledFileAppender recognizes the option Port.

The Port option is used for setting the port for listening to external roll over messages.

Overrides:
setOption in class RollingFileAppender

setPort

public void setPort(int port)
The Port option is used for setting the port for listening to external roll over messages.

getPort

public int getPort()
Returns value of the Port option.

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

Log4j 1.1.3

Please notify me about new log4j releases.