Package org.apache.log4j.bridge
Class AppenderWrapper
- java.lang.Object
-
- org.apache.log4j.bridge.AppenderWrapper
-
-
Constructor Summary
Constructors Constructor Description AppenderWrapper(Appender appender)Constructs a new instance for a Core Appender.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Appenderadapt(Appender appender)Adapts a Log4j 2.x appender into a Log4j 1.x appender.voidaddFilter(Filter newFilter)Add a filter to the end of the filter list.voidclearFilters()Clear the list of filters by removing all the filters in it.voidclose()Release any resources allocated within the appender such as file handles, network connections, etc.voiddoAppend(LoggingEvent event)Log inAppenderspecific way.AppendergetAppender()Gets the wrapped Core Appender.ErrorHandlergetErrorHandler()Returns theErrorHandlerfor this appender.FiltergetFilter()Returns the head Filter.LayoutgetLayout()Returns this appenders layout.java.lang.StringgetName()Get the name of this appender.booleanrequiresLayout()Configurators call this method to determine if the appender requires a layout.voidsetErrorHandler(ErrorHandler errorHandler)Set theErrorHandlerfor this appender.voidsetLayout(Layout layout)Set theLayoutfor this appender.voidsetName(java.lang.String name)Set the name of this appender.
-
-
-
Constructor Detail
-
AppenderWrapper
public AppenderWrapper(Appender appender)
Constructs a new instance for a Core Appender.- Parameters:
appender- a Core Appender.
-
-
Method Detail
-
adapt
public static Appender adapt(Appender appender)
Adapts a Log4j 2.x appender into a Log4j 1.x appender. Applying this method on the result ofAppenderAdapter.adapt(Appender)should return the original Log4j 1.x appender.- Parameters:
appender- a Log4j 2.x appender- Returns:
- a Log4j 1.x appender or
nullif the parameter isnull
-
getAppender
public Appender getAppender()
Gets the wrapped Core Appender.- Returns:
- the wrapped Core Appender.
-
addFilter
public void addFilter(Filter newFilter)
Description copied from interface:AppenderAdd a filter to the end of the filter list.
-
getFilter
public Filter getFilter()
Description copied from interface:AppenderReturns the head Filter. The Filters are organized in a linked list and so all Filters on this Appender are available through the result.
-
clearFilters
public void clearFilters()
Description copied from interface:AppenderClear the list of filters by removing all the filters in it.- Specified by:
clearFiltersin interfaceAppender
-
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)
Description copied from interface:AppenderLog inAppenderspecific way. When appropriate, Loggers will call thedoAppendmethod of appender implementations in order to log.
-
getName
public java.lang.String getName()
Description copied from interface:AppenderGet the name of this appender.
-
setErrorHandler
public void setErrorHandler(ErrorHandler errorHandler)
Description copied from interface:AppenderSet theErrorHandlerfor this appender.- Specified by:
setErrorHandlerin interfaceAppender- Parameters:
errorHandler- The error handler.
-
getErrorHandler
public ErrorHandler getErrorHandler()
Description copied from interface:AppenderReturns theErrorHandlerfor this appender.- Specified by:
getErrorHandlerin interfaceAppender- Returns:
- The error handler.
-
setLayout
public void setLayout(Layout layout)
Description copied from interface:AppenderSet theLayoutfor this appender.
-
getLayout
public Layout getLayout()
Description copied from interface:AppenderReturns this appenders layout.
-
setName
public void setName(java.lang.String name)
Description copied from interface:AppenderSet the name of this appender. The name is used by other components to identify this appender.
-
requiresLayout
public boolean requiresLayout()
Description copied from interface:AppenderConfigurators call this method to determine if the appender requires a layout. If this method returnstrue, meaning that layout is required, then the configurator will configure an layout using the configuration information at its disposal. If this method returnsfalse, meaning that a layout is not required, then layout configuration will be skipped even if there is available layout configuration information at the disposal of the configurator..In the rather exceptional case, where the appender implementation admits a layout but can also work without it, then the appender should return
true.- Specified by:
requiresLayoutin interfaceAppender- Returns:
- true if a Layout is required.
-
-