Class RandomAccessFileAppender
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.AbstractFilterable
org.apache.logging.log4j.core.appender.AbstractAppender
org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<RandomAccessFileManager>
org.apache.logging.log4j.core.appender.RandomAccessFileAppender
- All Implemented Interfaces:
Appender,Filterable,LocationAware,LifeCycle,LifeCycle2
@Plugin(name="RandomAccessFile",
category="Core",
elementType="appender",
printObject=true)
public final class RandomAccessFileAppender
extends AbstractOutputStreamAppender<RandomAccessFileManager>
File Appender.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilds RandomAccessFileAppender instances.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.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGERFields inherited from interface org.apache.logging.log4j.core.Appender
ELEMENT_TYPE, EMPTY_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionstatic <B extends RandomAccessFileAppender.Builder<B>>
RandomAccessFileAppendercreateAppender(String fileName, String append, String name, String immediateFlush, String bufferSizeStr, String ignore, Layout<? extends Serializable> layout, Filter filter, String advertise, String advertiseURI, Configuration configuration) Deprecated.intReturns the size of the file manager's buffer.Returns the file name this appender is associated with.static <B extends RandomAccessFileAppender.Builder<B>>
BCreates a builder for a RandomAccessFileAppender.booleanCleanup the Filter.Methods inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender
append, directEncodeEvent, getImmediateFlush, getManager, start, stop, writeByteArrayToManagerMethods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toStringMethods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilterMethods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
-
Method Details
-
stop
Description copied from class:AbstractFilterableCleanup the Filter.- Specified by:
stopin interfaceLifeCycle2- Overrides:
stopin classAbstractOutputStreamAppender<RandomAccessFileManager>- Parameters:
timeout- the maximum time to waittimeUnit- the time unit of the timeout argument- Returns:
- true if the receiver was stopped cleanly and normally, false otherwise.
-
getFileName
Returns the file name this appender is associated with.- Returns:
- The File name.
-
getBufferSize
public int getBufferSize()Returns the size of the file manager's buffer.- Returns:
- the buffer size
-
createAppender
@Deprecated public static <B extends RandomAccessFileAppender.Builder<B>> RandomAccessFileAppender createAppender(String fileName, String append, String name, String immediateFlush, String bufferSizeStr, String ignore, Layout<? extends Serializable> layout, Filter filter, String advertise, String advertiseURI, Configuration configuration) Deprecated.UsenewBuilder().Create a File Appender.- Parameters:
fileName- The name and path of the file.append- "True" if the file should be appended to, "false" if it should be overwritten. The default is "true".name- The name of the Appender.immediateFlush- "true" if the contents should be flushed on every write, "false" otherwise. The default is "true".bufferSizeStr- The buffer size, defaults to 262144.ignore- If"true"(default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.layout- The layout to use to format the event. If no layout is provided the default PatternLayout will be used.filter- The filter, if any, to use.advertise- "true" if the appender configuration should be advertised, "false" otherwise.advertiseURI- The advertised URI which can be used to retrieve the file contents.configuration- The Configuration.- Returns:
- The FileAppender.
-
newBuilder
Creates a builder for a RandomAccessFileAppender.- Returns:
- a builder for a RandomAccessFileAppender.
-
newBuilder().