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 void
addFilter(Filter newFilter)
Add a filter to the end of the filter list.void
clearFilters()
Clear the list of filters by removing all the filters in it.void
close()
Release any resources allocated within the appender such as file handles, network connections, etc.void
doAppend(LoggingEvent event)
Log inAppender
specific way.Appender
getAppender()
ErrorHandler
getErrorHandler()
Returns theErrorHandler
for this appender.Filter
getFilter()
Returns the head Filter.Layout
getLayout()
Returns this appenders layout.String
getName()
Get the name of this appender.boolean
requiresLayout()
Configurators call this method to determine if the appender requires a layout.void
setErrorHandler(ErrorHandler errorHandler)
Set theErrorHandler
for this appender.void
setLayout(Layout layout)
Set theLayout
for this appender.void
setName(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:Appender
Add a filter to the end of the filter list.
-
getFilter
public Filter getFilter()
Description copied from interface:Appender
Returns 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:Appender
Clear the list of filters by removing all the filters in it.- Specified by:
clearFilters
in interfaceAppender
-
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.
- Specified by:
close
in interfaceAppender
- Overrides:
close
in classAppenderAttachableImpl
-
doAppend
public void doAppend(LoggingEvent event)
Description copied from interface:Appender
Log inAppender
specific way. When appropriate, Loggers will call thedoAppend
method of appender implementations in order to log.
-
getName
public String getName()
Description copied from interface:Appender
Get the name of this appender.
-
setErrorHandler
public void setErrorHandler(ErrorHandler errorHandler)
Description copied from interface:Appender
Set theErrorHandler
for this appender.- Specified by:
setErrorHandler
in interfaceAppender
- Parameters:
errorHandler
- The error handler.
-
getErrorHandler
public ErrorHandler getErrorHandler()
Description copied from interface:Appender
Returns theErrorHandler
for this appender.- Specified by:
getErrorHandler
in interfaceAppender
- Returns:
- The error handler.
-
setLayout
public void setLayout(Layout layout)
Description copied from interface:Appender
Set theLayout
for this appender.
-
getLayout
public Layout getLayout()
Description copied from interface:Appender
Returns this appenders layout.
-
setName
public void setName(String name)
Description copied from interface:Appender
Set the name of this appender. The name is used by other components to identify this appender.
-
requiresLayout
public boolean requiresLayout()
Description copied from interface:Appender
Configurators 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:
requiresLayout
in interfaceAppender
- Returns:
- true if a Layout is required.
-
-