## 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 property 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` `ROLL_OVER` The string constant sent to initiate a roll over.

Fields inherited from class org.apache.log4j.RollingFileAppender
`maxBackupIndex, maxFileSize`

Fields inherited from class org.apache.log4j.FileAppender
`bufferedIO, bufferSize, fileAppend, fileName`

Fields inherited from class org.apache.log4j.WriterAppender
`encoding, immediateFlush, qw`

Fields inherited from class org.apache.log4j.AppenderSkeleton
`closed, errorHandler, headFilter, layout, name, tailFilter, threshold`

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 `setPort(int)`.
`int` `getPort()` Returns value of the Port option.
`void` `setPort(int port)` The Port [roperty 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, setMaximumFileSize, setQWForFiles, subAppend`

Methods inherited from class org.apache.log4j.FileAppender
`closeFile, getAppend, getBufferedIO, getBufferSize, getFile, reset, setAppend, setBufferedIO, setBufferSize, setFile`

Methods inherited from class org.apache.log4j.WriterAppender
`append, checkEntryConditions, close, closeWriter, createWriter, getEncoding, getImmediateFlush, requiresLayout, setEncoding, setErrorHandler, setImmediateFlush, setWriter, shouldFlush, 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

### 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.

  See Also:
    Constant Field Values

### OK

    public static final String OK

  The string constant sent to acknowledge a roll over. Current value of this string constant is OK.

  See Also:
    Constant Field Values

Constructor Detail

### ExternallyRolledFileAppender

    public ExternallyRolledFileAppender()

  The default constructor does nothing but calls its super-class constructor.

Method Detail

### setPort

    public void setPort(int port)

  The Port [roperty 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 `setPort(int)`.

  Specified by:
    `activateOptions` in interface `OptionHandler`
  Overrides:
    `activateOptions` in class `FileAppender`

Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.