Class FileAppender
- All Implemented Interfaces:
Appender, Filterable, LocationAware, LifeCycle, LifeCycle2
@Plugin(name="File",
category="Core",
elementType="appender",
printObject=true)
public final class FileAppender
extends AbstractOutputStreamAppender<FileManager>
File Appender.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFileAppender.Builder<B extends FileAppender.Builder<B>>Builds FileAppender instances.Nested classes/interfaces inherited from interface LifeCycle
LifeCycle.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Objectprivate final Advertiserprivate static final intprivate final Stringstatic final StringFields inherited from class AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGERFields inherited from interface Appender
ELEMENT_TYPE, EMPTY_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateFileAppender(String name, Layout<? extends Serializable> layout, Filter filter, FileManager manager, String filename, boolean ignoreExceptions, boolean immediateFlush, Advertiser advertiser, Property[] properties) -
Method Summary
Modifier and TypeMethodDescriptionstatic <B extends FileAppender.Builder<B>>
FileAppendercreateAppender(String fileName, String append, String locking, String name, String immediateFlush, String ignoreExceptions, String bufferedIo, String bufferSizeStr, Layout<? extends Serializable> layout, Filter filter, String advertise, String advertiseUri, Configuration config) Deprecated.Returns the file name this appender is associated with.static <B extends FileAppender.Builder<B>>
BbooleanCleanup the Filter.Methods inherited from class AbstractOutputStreamAppender
append, directEncodeEvent, getImmediateFlush, getManager, start, stop, writeByteArrayToManagerMethods inherited from class AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toStringMethods inherited from class AbstractFilterable
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilterMethods inherited from class AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
-
Field Details
-
PLUGIN_NAME
- See Also:
-
DEFAULT_BUFFER_SIZE
private static final int DEFAULT_BUFFER_SIZE- See Also:
-
fileName
-
advertiser
-
advertisement
-
-
Constructor Details
-
FileAppender
private FileAppender(String name, Layout<? extends Serializable> layout, Filter filter, FileManager manager, String filename, boolean ignoreExceptions, boolean immediateFlush, Advertiser advertiser, Property[] properties)
-
-
Method Details
-
createAppender
@Deprecated public static <B extends FileAppender.Builder<B>> FileAppender createAppender(String fileName, String append, String locking, String name, String immediateFlush, String ignoreExceptions, String bufferedIo, String bufferSizeStr, Layout<? extends Serializable> layout, Filter filter, String advertise, String advertiseUri, Configuration config) 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".locking- "True" if the file should be locked. The default is "false".name- The name of the Appender.immediateFlush- "true" if the contents should be flushed on every write, "false" otherwise. The default is "true".ignoreExceptions- If"true"(default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.bufferedIo- "true" if I/O should be buffered, "false" otherwise. The default is "true".bufferSizeStr- buffer size for buffered IO (default is 8192).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.config- The Configuration- Returns:
- The FileAppender.
-
newBuilder
-
getFileName
Returns the file name this appender is associated with.- Returns:
- The File name.
-
stop
Description copied from class:AbstractFilterableCleanup the Filter.- Specified by:
stopin interfaceLifeCycle2- Overrides:
stopin classAbstractOutputStreamAppender<FileManager>- 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.
-
newBuilder()