Class SizeBasedTriggeringPolicy

All Implemented Interfaces:
TriggeringPolicy, LifeCycle, LifeCycle2

@Plugin(name="SizeBasedTriggeringPolicy", category="Core", printObject=true) public class SizeBasedTriggeringPolicy extends AbstractTriggeringPolicy
  • Constructor Details

    • SizeBasedTriggeringPolicy

      protected SizeBasedTriggeringPolicy()
      Constructs a new instance.
    • SizeBasedTriggeringPolicy

      protected SizeBasedTriggeringPolicy(long maxFileSize)
      Constructs a new instance.
      Parameters:
      maxFileSize - rollover threshold size in bytes.
  • Method Details

    • getMaxFileSize

      public long getMaxFileSize()
    • initialize

      public void initialize(RollingFileManager aManager)
      Initialize the TriggeringPolicy.
      Parameters:
      aManager - The RollingFileManager.
    • isTriggeringEvent

      public boolean isTriggeringEvent(LogEvent event)
      Returns true if a rollover should occur.
      Parameters:
      event - A reference to the currently event.
      Returns:
      true if a rollover should take place, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createPolicy

      @PluginFactory public static SizeBasedTriggeringPolicy createPolicy(@PluginAttribute("size") String size)
      Create a SizeBasedTriggeringPolicy.
      Parameters:
      size - The size of the file before rollover is required.
      Returns:
      A SizeBasedTriggeringPolicy.