Package org.apache.log4j.varia
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.log4j.AppenderSkeleton
AppenderSkeleton.NoOpErrorHandler
-
-
Field Summary
Fields Modifier and Type Field Description private static NullAppenderINSTANCE-
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
-
-
Constructor Summary
Constructors Constructor Description NullAppender()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactivateOptions()There are no options to acticate.protected voidappend(LoggingEvent event)Does not do anything.voidclose()Release any resources allocated within the appender such as file handles, network connections, etc.voiddoAppend(LoggingEvent event)Does not do anything.NullAppendergetInstance()Deprecated.Use getNullAppender instead.static NullAppendergetNullAppender()Whenever you can, use this method to retreive an instance instead of instantiating a new one withnew.booleanrequiresLayout()NullAppenders do not need a layout.-
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
-
-
-
-
Field Detail
-
INSTANCE
private static final NullAppender INSTANCE
-
-
Method Detail
-
getNullAppender
public static NullAppender getNullAppender()
Whenever you can, use this method to retreive an instance instead of instantiating a new one withnew.
-
activateOptions
public void activateOptions()
There are no options to acticate.- Specified by:
activateOptionsin interfaceOptionHandler- Overrides:
activateOptionsin classAppenderSkeleton
-
append
protected void append(LoggingEvent event)
Does not do anything.- Specified by:
appendin classAppenderSkeleton
-
close
public void close()
Description copied from interface:AppenderRelease 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:
doAppendin interfaceAppender- Overrides:
doAppendin classAppenderSkeleton- 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 withnew.
-
requiresLayout
public boolean requiresLayout()
NullAppenders do not need a layout.- Returns:
- true if a Layout is required.
-
-