Class IdlePurgePolicy

All Implemented Interfaces:
Runnable, PurgePolicy, LifeCycle, LifeCycle2

@Plugin(name="IdlePurgePolicy", category="Core", printObject=true) @Scheduled public class IdlePurgePolicy extends AbstractLifeCycle implements PurgePolicy, Runnable
Policy is purging appenders that were not in use specified time in minutes
  • Constructor Details

    • IdlePurgePolicy

      public IdlePurgePolicy(long timeToLive, long checkInterval, ConfigurationScheduler scheduler)
  • Method Details

    • initialize

      public void initialize(RoutingAppender routingAppender)
      Description copied from interface: PurgePolicy
      Initializes with routing appender
      Specified by:
      initialize in interface PurgePolicy
      routingAppender - the routed appender for purging
    • stop

      public boolean stop(long timeout, TimeUnit timeUnit)
      Description copied from interface: LifeCycle2
      Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
      Specified by:
      stop in interface LifeCycle2
      stop in class AbstractLifeCycle
      timeout - the maximum time to wait
      timeUnit - the time unit of the timeout argument
      true if the receiver was stopped cleanly and normally, false otherwise.
    • purge

      public void purge()
      Purging appenders that were not in use specified time
      Specified by:
      purge in interface PurgePolicy
    • update

      public void update(String key, LogEvent event)
      Specified by:
      update in interface PurgePolicy
      key - routed appender key
      event - Provides contextual information about a logged message.
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • createPurgePolicy

      @PluginFactory public static PurgePolicy createPurgePolicy(@PluginAttribute("timeToLive") String timeToLive, @PluginAttribute("checkInterval") String checkInterval, @PluginAttribute("timeUnit") String timeUnit, @PluginConfiguration Configuration configuration)
      Create the PurgePolicy
      timeToLive - the number of increments of timeUnit before the Appender should be purged.
      checkInterval - when all appenders purged, the number of increments of timeUnit to check if any appenders appeared
      timeUnit - the unit of time the timeToLive and the checkInterval is expressed in.
      The Routes container.
    • toString

      public String toString()
      toString in class Object