@Plugin(name="RollingFile", category="Core", elementType="appender", printObject=true) public final class RollingFileAppender extends AbstractOutputStreamAppender<RollingFileManager>
Modifier and Type | Class and Description |
---|---|
static class |
RollingFileAppender.Builder<B extends RollingFileAppender.Builder<B>>
Builds FileAppender instances.
|
LifeCycle.State
Modifier and Type | Field and Description |
---|---|
static String |
PLUGIN_NAME |
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
ELEMENT_TYPE
Modifier and Type | Method and Description |
---|---|
void |
append(LogEvent event)
Writes the log entry rolling over the file when required.
|
static <B extends RollingFileAppender.Builder<B>> |
createAppender(String fileName,
String filePattern,
String append,
String name,
String bufferedIO,
String bufferSizeStr,
String immediateFlush,
TriggeringPolicy policy,
RolloverStrategy strategy,
Layout<? extends Serializable> layout,
Filter filter,
String ignore,
String advertise,
String advertiseUri,
Configuration config)
Deprecated.
Use
newBuilder() . |
String |
getFileName()
Returns the File name for the Appender.
|
String |
getFilePattern()
Returns the file pattern used when rolling over.
|
<T extends TriggeringPolicy> |
getTriggeringPolicy()
Returns the triggering policy.
|
static <B extends RollingFileAppender.Builder<B>> |
newBuilder()
Creates a new Builder.
|
boolean |
stop(long timeout,
TimeUnit timeUnit)
Cleanup the Filter.
|
directEncodeEvent, getImmediateFlush, getManager, start, stop, writeByteArrayToManager
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toString
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
public static final String PLUGIN_NAME
public boolean stop(long timeout, TimeUnit timeUnit)
AbstractFilterable
stop
in interface LifeCycle2
stop
in class AbstractOutputStreamAppender<RollingFileManager>
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argumentpublic void append(LogEvent event)
append
in interface Appender
append
in class AbstractOutputStreamAppender<RollingFileManager>
event
- The LogEvent.public String getFileName()
public String getFilePattern()
public <T extends TriggeringPolicy> T getTriggeringPolicy()
T
- TriggeringPolicy type@Deprecated public static <B extends RollingFileAppender.Builder<B>> RollingFileAppender createAppender(String fileName, String filePattern, String append, String name, String bufferedIO, String bufferSizeStr, String immediateFlush, TriggeringPolicy policy, RolloverStrategy strategy, Layout<? extends Serializable> layout, Filter filter, String ignore, String advertise, String advertiseUri, Configuration config)
newBuilder()
.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).bufferedIO
- When true, I/O will be buffered. Defaults to "true".bufferSizeStr
- buffer size for buffered IO (default is 8192).immediateFlush
- When true, events are immediately flushed. Defaults to "true".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.@PluginBuilderFactory public static <B extends RollingFileAppender.Builder<B>> B newBuilder()
Copyright © 1999-2021 The 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.