Class CronTriggeringPolicy

All Implemented Interfaces:
TriggeringPolicy, LifeCycle, LifeCycle2

@Plugin(name="CronTriggeringPolicy", category="Core", printObject=true) @Scheduled public final class CronTriggeringPolicy extends AbstractTriggeringPolicy
Rolls a file over based on a cron schedule.
  • Method Details

    • initialize

      public void initialize(RollingFileManager aManager)
      Initializes the policy.
      Parameters:
      aManager - The RollingFileManager.
    • isTriggeringEvent

      public boolean isTriggeringEvent(LogEvent event)
      Determines whether a rollover should occur.
      Parameters:
      event - A reference to the currently event.
      Returns:
      true if a rollover should occur.
    • getCronExpression

      public CronExpression getCronExpression()
    • createPolicy

      @PluginFactory public static CronTriggeringPolicy createPolicy(@PluginConfiguration Configuration configuration, @PluginAttribute("evaluateOnStartup") String evaluateOnStartup, @PluginAttribute("schedule") String schedule)
      Creates a ScheduledTriggeringPolicy.
      Parameters:
      configuration - the Configuration.
      evaluateOnStartup - check if the file should be rolled over immediately.
      schedule - the cron expression.
      Returns:
      a ScheduledTriggeringPolicy.
    • 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
      Overrides:
      stop in class AbstractLifeCycle
      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.
    • toString

      public String toString()
      Overrides:
      toString in class Object