Class SharedRollingFileAppender
- All Implemented Interfaces:
org.apache.logging.log4j.core.Appender,org.apache.logging.log4j.core.appender.rolling.RolloverListener,org.apache.logging.log4j.core.filter.Filterable,org.apache.logging.log4j.core.impl.LocationAware,org.apache.logging.log4j.core.LifeCycle,org.apache.logging.log4j.core.LifeCycle2
Additional parameters:
fileLock - path to the file to be used for shared locking (will be created if needed). The same lock can be used for different appenders.
resourceLock - path to the resource to be used for shared locking (must not be packed within archive).
messageQueueSize - message queue size to be used as a buffer for asynchronous processing to soften heavy file locking operations time
default 1K.
writerThreadKeepAliveTimeSec - if value is greater than zero, it is used as a time to shut down background non-daemon writer thread guarantee messages flush to the
file system in the background thread but not prevent normal JVM shutdown when idle. Rare messages may experience short delays (~0.3s) starting worker thread. If value is
zero, endless daemon worker thread is started not preventing normal JVM shutdown but without any guarantee of messages processing before shutdown. This approach has no write
time delays and continuous worker thread recreation after idle times (suitable for long running applications).
default 3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
org.apache.logging.log4j.core.LifeCycle.State -
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(org.apache.logging.log4j.core.LogEvent event) protected voiddoAppend(org.apache.logging.log4j.core.LogEvent event) Writes the log entry rolling over the file when required.Returns the File name for the Appender.Returns the file pattern used when rolling over.<T extends org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy>
TReturns the triggering policy.static <B extends SharedRollingFileAppender.Builder<B>>
BCreates a new Builder.protected voidvoidrolloverComplete(String fileName) voidrolloverTriggered(String fileName) booleanMethods inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender
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, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.logging.log4j.core.LifeCycle
getState, initialize, isStarted, isStopped, stop
-
Field Details
-
PLUGIN_NAME
- See Also:
-
-
Method Details
-
processQueue
protected void processQueue() -
rolloverTriggered
- Specified by:
rolloverTriggeredin interfaceorg.apache.logging.log4j.core.appender.rolling.RolloverListener
-
rolloverComplete
- Specified by:
rolloverCompletein interfaceorg.apache.logging.log4j.core.appender.rolling.RolloverListener
-
stop
- Specified by:
stopin interfaceorg.apache.logging.log4j.core.LifeCycle2- Overrides:
stopin classorg.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<org.apache.logging.log4j.core.appender.rolling.RollingFileManager>
-
append
public void append(org.apache.logging.log4j.core.LogEvent event) - Specified by:
appendin interfaceorg.apache.logging.log4j.core.Appender- Overrides:
appendin classorg.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<org.apache.logging.log4j.core.appender.rolling.RollingFileManager>
-
doAppend
protected void doAppend(org.apache.logging.log4j.core.LogEvent event) Writes the log entry rolling over the file when required.- Parameters:
event- The LogEvent.
-
getFileName
Returns the File name for the Appender.- Returns:
- The file name.
-
getFilePattern
Returns the file pattern used when rolling over.- Returns:
- The file pattern.
-
getTriggeringPolicy
public <T extends org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy> T getTriggeringPolicy()Returns the triggering policy.- Type Parameters:
T- TriggeringPolicy type- Returns:
- The TriggeringPolicy
-
newBuilder
Creates a new Builder.- Returns:
- a new Builder.
- Since:
- 2.7
-