Log4j 0.9.1

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.
 
Fields inherited from class org.log4j.RollingFileAppender
MAX_BACKUP_INDEX_OPTION, MAX_FILE_SIZE_OPTION, maxBackupIndex, maxFileSize
 
Fields inherited from class org.log4j.FileAppender
APPEND_OPTION, FILE_OPTION, fileAppend, fileName, IMMEDIATE_FLUSH_OPTION, immediateFlush, qw, qwIsOurs, tp
 
Fields inherited from class org.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold, THRESHOLD_OPTION
 
Constructor Summary
ExternallyRolledFileAppender()
          Thia default constructor does nothing but call 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()
          Retuns the option names for this component, namely PORT_OPTION in addition to the options of its super class FileAppender.
 void setOption(String option, String value)
          The Port options takes a
 
Methods inherited from class org.log4j.RollingFileAppender
rollOver, setFile, setMaxBackupIndex, setMaxFileSize, setQWForFiles, subAppend
 
Methods inherited from class org.log4j.FileAppender
append, checkEntryConditions, close, closeWriterIfOurs, requiresLayout, reset, setErrorHandler, setFile, setWriter
 
Methods inherited from class org.log4j.AppenderSkeleton
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFirstFilter, getName, 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
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()
Thia default constructor does nothing but call its super-class constructor.
Method Detail

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

Log4j 0.9.1

Please notify me about new log4j releases.