Class AsyncLoggerContext

    • Constructor Detail

      • AsyncLoggerContext

        public AsyncLoggerContext​(String name)
      • AsyncLoggerContext

        public AsyncLoggerContext​(String name,
                                  Object externalContext)
      • AsyncLoggerContext

        public AsyncLoggerContext​(String name,
                                  Object externalContext,
                                  URI configLocn)
      • AsyncLoggerContext

        public AsyncLoggerContext​(String name,
                                  Object externalContext,
                                  String configLocn)
    • Method Detail

      • setName

        public void setName​(String name)
        Description copied from class: LoggerContext
        Sets the name.
        Overrides:
        setName in class LoggerContext
        Parameters:
        name - the new LoggerContext name
      • start

        public void start​(Configuration config)
        Description copied from class: LoggerContext
        Starts with a specific configuration.
        Overrides:
        start in class LoggerContext
        Parameters:
        config - The new Configuration.
      • stop

        public boolean stop​(long timeout,
                            TimeUnit timeUnit)
        Description copied from class: LoggerContext
        Blocks until all Log4j tasks have completed execution after a shutdown request and all appenders have shut down, or the timeout occurs, or the current thread is interrupted, whichever happens first.

        Not all appenders will honor this, it is a hint and not an absolute guarantee that the this method not block longer. Setting timeout too low increase the risk of losing outstanding log events not yet written to the final destination.

        Log4j can start threads to perform certain actions like file rollovers, calling this method with a positive timeout will block until the rollover thread is done.

        Specified by:
        stop in interface LifeCycle2
        Overrides:
        stop in class LoggerContext
        Parameters:
        timeout - the maximum time to wait, or 0 which mean that each apppender uses its default timeout, and don't wait for background tasks
        timeUnit - the time unit of the timeout argument
        Returns:
        true if the logger context terminated and false if the timeout elapsed before termination.
      • createRingBufferAdmin

        public RingBufferAdmin createRingBufferAdmin()
        Creates and returns a new RingBufferAdmin that instruments the ringbuffer of the AsyncLogger objects in this LoggerContext.
        Returns:
        a new RingBufferAdmin that instruments the ringbuffer
      • setUseThreadLocals

        public void setUseThreadLocals​(boolean useThreadLocals)
        Signals this context whether it is allowed to use ThreadLocal objects for efficiency.
        Parameters:
        useThreadLocals - whether this context is allowed to use ThreadLocal objects