Package org.apache.log4j.bridge
Class AppenderWrapper
- java.lang.Object
-
- org.apache.log4j.helpers.AppenderAttachableImpl
-
- org.apache.log4j.bridge.AppenderWrapper
-
- All Implemented Interfaces:
Appender,AppenderAttachable
public class AppenderWrapper extends AppenderAttachableImpl implements Appender
Holds a Log4j 2 Appender in an empty Log4j 1 Appender so it can be extracted when constructing the configuration. Allows a Log4j 1 Appender to reference a Log4j 2 Appender.
-
-
Constructor Summary
Constructors Constructor Description AppenderWrapper(Appender appender)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()ErrorHandlergetErrorHandler()Returns theErrorHandlerfor this appender.FiltergetFilter()Returns the head Filter.LayoutgetLayout()Returns this appenders layout.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(String name)Set the name of this appender.-
Methods inherited from class org.apache.log4j.helpers.AppenderAttachableImpl
addAppender, appendLoopOnAppenders, getAllAppenders, getAppender, isAttached, removeAllAppenders, removeAppender, removeAppender
-
-
-
-
Constructor Detail
-
AppenderWrapper
public AppenderWrapper(Appender appender)
-
-
Method Detail
-
getAppender
public Appender getAppender()
-
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.
- Specified by:
closein interfaceAppender- Overrides:
closein classAppenderAttachableImpl
-
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 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(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.
-
-