org.apache.logging.log4j.core.appender
Class RollingRandomAccessFileAppender

java.lang.Object
  extended by org.apache.logging.log4j.core.AbstractLifeCycle
      extended by org.apache.logging.log4j.core.filter.AbstractFilterable
          extended by org.apache.logging.log4j.core.appender.AbstractAppender
              extended by org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<RollingFileManager>
                  extended by org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender
All Implemented Interfaces:
Serializable, Appender, Filterable, LifeCycle

@Plugin(name="RollingRandomAccessFile",
        category="Core",
        elementType="appender",
        printObject=true)
public final class RollingRandomAccessFileAppender
extends AbstractOutputStreamAppender<RollingFileManager>

An appender that writes to random access files and can roll over at intervals.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
 
Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender
immediateFlush
 
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
LOGGER
 
Method Summary
 void append(LogEvent event)
          Write the log entry rolling over the file when required.
static RollingRandomAccessFileAppender createAppender(String fileName, String filePattern, String append, String name, String immediateFlush, String bufferSizeStr, TriggeringPolicy policy, RolloverStrategy strategy, Layout<? extends Serializable> layout, Filter filter, String ignore, String advertise, String advertiseURI, Configuration config)
          Create a RollingRandomAccessFileAppender.
 int getBufferSize()
          Returns the size of the file manager's buffer.
 String getFileName()
          Returns the File name for the Appender.
 String getFilePattern()
          Returns the file pattern used when rolling over.
 void stop()
          Cleanup the Filter.
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender
getManager, start
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString
 
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, hasFilter, isFiltered, removeFilter
 
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equals, getState, hashCode, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
isStarted, isStopped
 

Method Detail

stop

public void stop()
Description copied from class: AbstractFilterable
Cleanup the Filter.

Specified by:
stop in interface LifeCycle
Overrides:
stop in class AbstractOutputStreamAppender<RollingFileManager>

append

public void append(LogEvent event)
Write the log entry rolling over the file when required.

Specified by:
append in interface Appender
Overrides:
append in class AbstractOutputStreamAppender<RollingFileManager>
Parameters:
event - The LogEvent.

getFileName

public String getFileName()
Returns the File name for the Appender.

Returns:
The file name.

getFilePattern

public String getFilePattern()
Returns the file pattern used when rolling over.

Returns:
The file pattern.

getBufferSize

public int getBufferSize()
Returns the size of the file manager's buffer.

Returns:
the buffer size

createAppender

@PluginFactory
public static RollingRandomAccessFileAppender createAppender(@PluginAttribute(value="fileName")
                                                                           String fileName,
                                                                           @PluginAttribute(value="filePattern")
                                                                           String filePattern,
                                                                           @PluginAttribute(value="append")
                                                                           String append,
                                                                           @PluginAttribute(value="name")
                                                                           String name,
                                                                           @PluginAttribute(value="immediateFlush")
                                                                           String immediateFlush,
                                                                           @PluginAttribute(value="bufferSize")
                                                                           String bufferSizeStr,
                                                                           @PluginElement(value="Policy")
                                                                           TriggeringPolicy policy,
                                                                           @PluginElement(value="Strategy")
                                                                           RolloverStrategy strategy,
                                                                           @PluginElement(value="Layout")
                                                                           Layout<? extends Serializable> layout,
                                                                           @PluginElement(value="Filter")
                                                                           Filter filter,
                                                                           @PluginAttribute(value="ignoreExceptions")
                                                                           String ignore,
                                                                           @PluginAttribute(value="advertise")
                                                                           String advertise,
                                                                           @PluginAttribute(value="advertiseURI")
                                                                           String advertiseURI,
                                                                           @PluginConfiguration
                                                                           Configuration config)
Create a RollingRandomAccessFileAppender.

Parameters:
fileName - The name of the file that is actively written to. (required).
filePattern - The pattern of the file name to use on rollover. (required).
append - If true, events are appended to the file. If false, the file is overwritten when opened. Defaults to "true"
name - The name of the Appender (required).
immediateFlush - When true, events are immediately flushed. Defaults to "true".
bufferSizeStr - The buffer size, defaults to .
policy - The triggering policy. (required).
strategy - The rollover strategy. Defaults to DefaultRolloverStrategy.
layout - The layout to use (defaults to the default PatternLayout).
filter - The Filter or null.
ignore - If "true" (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
advertise - "true" if the appender configuration should be advertised, "false" otherwise.
advertiseURI - The advertised URI which can be used to retrieve the file contents.
config - The Configuration.
Returns:
A RollingRandomAccessFileAppender.


Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.