Package org.apache.log4j.bridge
Class AppenderWrapper
java.lang.Object
org.apache.log4j.bridge.AppenderWrapper
- All Implemented Interfaces:
Appender
Wraps 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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAppenderWrapper
(Appender appender) Constructs a new instance for a Core Appender. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a filter to the end of the filter list.void
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.Gets the wrapped Core Appender.Returns theErrorHandler
for this appender.Returns the head Filter.Returns this appenders layout.getName()
Get the name of this appender.boolean
Configurators call this method to determine if the appender requires a layout.void
setErrorHandler
(ErrorHandler errorHandler) Set theErrorHandler
for this appender.void
Set theLayout
for this appender.void
Set the name of this appender.
-
Field Details
-
LOGGER
-
appender
-
-
Constructor Details
-
AppenderWrapper
Constructs a new instance for a Core Appender.- Parameters:
appender
- a Core Appender.
-
-
Method Details
-
getAppender
Gets the wrapped Core Appender.- Returns:
- the wrapped Core Appender.
-
addFilter
Description copied from interface:Appender
Add a filter to the end of the filter list. -
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.
-
doAppend
Description copied from interface:Appender
Log inAppender
specific way. When appropriate, Loggers will call thedoAppend
method of appender implementations in order to log. -
getName
Description copied from interface:Appender
Get the name of this appender. -
setErrorHandler
Description copied from interface:Appender
Set theErrorHandler
for this appender.- Specified by:
setErrorHandler
in interfaceAppender
- Parameters:
errorHandler
- The error handler.
-
getErrorHandler
Description copied from interface:Appender
Returns theErrorHandler
for this appender.- Specified by:
getErrorHandler
in interfaceAppender
- Returns:
- The error handler.
-
setLayout
Description copied from interface:Appender
Set theLayout
for this appender. -
getLayout
Description copied from interface:Appender
Returns this appenders layout. -
setName
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.
-