org.apache.logging.log4j.core.appender

Class AsyncAppender

    • Method Detail

      • stop

        public boolean stop(long timeout,
                   TimeUnit timeUnit)
        Description copied from class: AbstractFilterable
        Cleanup the Filter.
        Specified by:
        stop in interface LifeCycle2
        Overrides:
        stop in class AbstractFilterable
        Parameters:
        timeout - the maximum time to wait
        timeUnit - the time unit of the timeout argument
        Returns:
        true if the receiver was stopped cleanly and normally, false otherwise.
      • append

        public void append(LogEvent logEvent)
        Actual writing occurs here.
        Parameters:
        logEvent - The LogEvent.
      • logMessageInCurrentThread

        public void logMessageInCurrentThread(LogEvent logEvent)
        FOR INTERNAL USE ONLY.
        Parameters:
        logEvent - the event to log
      • logMessageInBackgroundThread

        public void logMessageInBackgroundThread(LogEvent logEvent)
        FOR INTERNAL USE ONLY.
        Parameters:
        logEvent - the event to log
      • createAppender

        @Deprecated
        public static AsyncAppender createAppender(AppenderRef[] appenderRefs,
                                              String errorRef,
                                              boolean blocking,
                                              long shutdownTimeout,
                                              int size,
                                              String name,
                                              boolean includeLocation,
                                              Filter filter,
                                              Configuration config,
                                              boolean ignoreExceptions)
        Deprecated. use AsyncAppender.Builder instead
        Create an AsyncAppender. This method is retained for backwards compatibility. New code should use the AsyncAppender.Builder instead. This factory will use ArrayBlockingQueueFactory by default as was the behavior pre-2.7.
        Parameters:
        appenderRefs - The Appenders to reference.
        errorRef - An optional Appender to write to if the queue is full or other errors occur.
        blocking - True if the Appender should wait when the queue is full. The default is true.
        shutdownTimeout - How many milliseconds the Appender should wait to flush outstanding log events in the queue on shutdown. The default is zero which means to wait forever.
        size - The size of the event queue. The default is 128.
        name - The name of the Appender.
        includeLocation - whether to include location information. The default is false.
        filter - The Filter or null.
        config - The Configuration.
        ignoreExceptions - If "true" (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
        Returns:
        The AsyncAppender.
      • getAppenderRefStrings

        public String[] getAppenderRefStrings()
        Returns the names of the appenders that this asyncAppender delegates to as an array of Strings.
        Returns:
        the names of the sink appenders
      • isIncludeLocation

        public boolean isIncludeLocation()
        Returns true if this AsyncAppender will take a snapshot of the stack with every log event to determine the class and method where the logging call was made.
        Returns:
        true if location is included with every event, false otherwise
      • isBlocking

        public boolean isBlocking()
        Returns true if this AsyncAppender will block when the queue is full, or false if events are dropped when the queue is full.
        Returns:
        whether this AsyncAppender will block or drop events when the queue is full.
      • getErrorRef

        public String getErrorRef()
        Returns the name of the appender that any errors are logged to or null.
        Returns:
        the name of the appender that any errors are logged to or null
      • getQueueCapacity

        public int getQueueCapacity()
      • getQueueRemainingCapacity

        public int getQueueRemainingCapacity()

Copyright © 1999-2017 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.