@Plugin(name="File", category="Core", elementType="appender", printObject=true) public final class FileAppender extends AbstractOutputStreamAppender<FileManager>
LifeCycle.State
immediateFlush
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
Modifier and Type | Method and Description |
---|---|
static FileAppender |
createAppender(String fileName,
String append,
String locking,
String name,
String immediateFlush,
String ignore,
String bufferedIo,
String bufferSizeStr,
Layout<? extends Serializable> layout,
Filter filter,
String advertise,
String advertiseUri,
Configuration config)
Create a File Appender.
|
String |
getFileName()
Returns the file name this appender is associated with.
|
void |
stop()
Cleanup the Filter.
|
append, getManager, start
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString
addFilter, getFilter, hasFilter, isFiltered, removeFilter
equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping
public void stop()
AbstractFilterable
stop
in interface LifeCycle
stop
in class AbstractOutputStreamAppender<FileManager>
public String getFileName()
@PluginFactory public static FileAppender createAppender(@PluginAttribute(value="fileName") String fileName, @PluginAttribute(value="append") String append, @PluginAttribute(value="locking") String locking, @PluginAttribute(value="name") String name, @PluginAttribute(value="immediateFlush") String immediateFlush, @PluginAttribute(value="ignoreExceptions") String ignore, @PluginAttribute(value="bufferedIo") String bufferedIo, @PluginAttribute(value="bufferSize") String bufferSizeStr, @PluginElement(value="Layout") Layout<? extends Serializable> layout, @PluginElement(value="Filter") Filter filter, @PluginAttribute(value="advertise") String advertise, @PluginAttribute(value="advertiseUri") String advertiseUri, @PluginConfiguration Configuration config)
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".ignore
- 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 ConfigurationCopyright © 1999-2021 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.