Class AwaitCompletionReliabilityStrategy

java.lang.Object
org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy
All Implemented Interfaces:
LocationAwareReliabilityStrategy, ReliabilityStrategy

public class AwaitCompletionReliabilityStrategy extends Object implements ReliabilityStrategy, LocationAwareReliabilityStrategy
ReliabilityStrategy that counts the number of threads that have started to log an event but have not completed yet, and waits for these threads to finish before allowing the appenders to be stopped.
  • Field Details

  • Constructor Details

    • AwaitCompletionReliabilityStrategy

      public AwaitCompletionReliabilityStrategy(LoggerConfig loggerConfig)
  • Method Details

    • log

      public void log(Supplier<LoggerConfig> reconfigured, String loggerName, String fqcn, Marker marker, Level level, Message data, Throwable t)
      Description copied from interface: ReliabilityStrategy
      Logs an event.
      Specified by:
      log in interface ReliabilityStrategy
      Parameters:
      reconfigured - supplies the next LoggerConfig if the strategy's LoggerConfig is no longer active
      loggerName - The name of the Logger.
      fqcn - The fully qualified class name of the caller.
      marker - A Marker or null if none is present.
      level - The event Level.
      data - The Message.
      t - A Throwable or null.
    • log

      public void log(Supplier<LoggerConfig> reconfigured, String loggerName, String fqcn, StackTraceElement location, Marker marker, Level level, Message data, Throwable t)
      Description copied from interface: LocationAwareReliabilityStrategy
      Logs an event.
      Specified by:
      log in interface LocationAwareReliabilityStrategy
      Parameters:
      reconfigured - supplies the next LoggerConfig if the strategy's LoggerConfig is no longer active
      loggerName - The name of the Logger.
      fqcn - The fully qualified class name of the caller.
      location - The location of the caller or null.
      marker - A Marker or null if none is present.
      level - The event Level.
      data - The Message.
      t - A Throwable or null.
    • log

      public void log(Supplier<LoggerConfig> reconfigured, LogEvent event)
      Description copied from interface: ReliabilityStrategy
      Logs an event.
      Specified by:
      log in interface ReliabilityStrategy
      Parameters:
      reconfigured - supplies the next LoggerConfig if the strategy's LoggerConfig is no longer active
      event - The log event.
    • getActiveLoggerConfig

      public LoggerConfig getActiveLoggerConfig(Supplier<LoggerConfig> next)
      Description copied from interface: ReliabilityStrategy
      For internal use by the ReliabilityStrategy; returns the LoggerConfig to use.
      Specified by:
      getActiveLoggerConfig in interface ReliabilityStrategy
      Parameters:
      next - supplies the next LoggerConfig if the strategy's LoggerConfig is no longer active
      Returns:
      the currently active LoggerConfig
    • beforeLogEvent

      private boolean beforeLogEvent()
    • afterLogEvent

      public void afterLogEvent()
      Description copied from interface: ReliabilityStrategy
      Called after a log event was logged.
      Specified by:
      afterLogEvent in interface ReliabilityStrategy
    • signalCompletionIfShutdown

      private void signalCompletionIfShutdown()
    • beforeStopAppenders

      public void beforeStopAppenders()
      Description copied from interface: ReliabilityStrategy
      Called before all appenders are stopped.
      Specified by:
      beforeStopAppenders in interface ReliabilityStrategy
    • waitForCompletion

      private void waitForCompletion()
      Waits for all log events to complete before returning.
    • beforeStopConfiguration

      public void beforeStopConfiguration(Configuration configuration)
      Description copied from interface: ReliabilityStrategy
      Called before the configuration is stopped.
      Specified by:
      beforeStopConfiguration in interface ReliabilityStrategy
      Parameters:
      configuration - the configuration that will be stopped