Class NullAppender

java.lang.Object
org.apache.log4j.AppenderSkeleton
org.apache.log4j.varia.NullAppender
All Implemented Interfaces:
Appender, OptionHandler

public class NullAppender extends AppenderSkeleton
A NullAppender never outputs a message to any device.
  • Field Details

  • Constructor Details

    • NullAppender

      public NullAppender()
  • Method Details

    • getNullAppender

      public static NullAppender getNullAppender()
      Whenever you can, use this method to retreive an instance instead of instantiating a new one with new.
    • activateOptions

      public void activateOptions()
      There are no options to acticate.
      Specified by:
      activateOptions in interface OptionHandler
      Overrides:
      activateOptions in class AppenderSkeleton
    • append

      protected void append(LoggingEvent event)
      Does not do anything.
      Specified by:
      append in class AppenderSkeleton
    • close

      public void close()
      Description copied from interface: Appender
      Release any resources allocated within the appender such as file handles, network connections, etc.

      It is a programming error to append to a closed appender.

    • doAppend

      public void doAppend(LoggingEvent event)
      Does not do anything.
      Specified by:
      doAppend in interface Appender
      Overrides:
      doAppend in class AppenderSkeleton
      Parameters:
      event - The LoggingEvent.
    • getInstance

      @Deprecated public NullAppender getInstance()
      Deprecated.
      Use getNullAppender instead. getInstance should have been static.
      Whenever you can, use this method to retreive an instance instead of instantiating a new one with new.
    • requiresLayout

      public boolean requiresLayout()
      NullAppenders do not need a layout.
      Returns:
      true if a Layout is required.