Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.logging.log4j.core.appender
Class AbstractAppender

    java.lang.Object
      org.apache.logging.log4j.core.AbstractLifeCycle
          org.apache.logging.log4j.core.filter.AbstractFilterable
              org.apache.logging.log4j.core.appender.AbstractAppender

All Implemented Interfaces:
  Serializable, Appender, Filterable, LifeCycle

Direct Known Subclasses:
  AbstractDatabaseAppender, AbstractOutputStreamAppender, AsyncAppender, FailoverAppender, JmsAppender, RewriteAppender, RoutingAppender, SmtpAppender

    public abstract class AbstractAppender

extends AbstractFilterable
implements Appender

Abstract base class for Appenders. Although Appenders do not have to extend this class, doing so will simplify their implementation.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
`LifeCycle.State`

Field Summary

Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
`LOGGER`

Constructor Summary
`protected` | `AbstractAppender(String name, Filter filter, Layout<? extends Serializable> layout)` Constructor that defaults to suppressing exceptions.
`protected` | `AbstractAppender(String name, Filter filter, Layout<? extends Serializable> layout, boolean ignoreExceptions)` Constructor.

Method Summary
`void` | `error(String msg)` Handle an error with a message using the `ErrorHandler` configured for this Appender.
`void` | `error(String msg, LogEvent event, Throwable t)` Handle an error with a message, exception, and a logging event, using the `ErrorHandler` configured for this Appender.
`void` | `error(String msg, Throwable t)` Handle an error with a message and an exception using the `ErrorHandler` configured for this Appender.
`ErrorHandler` | `getHandler()` Returns the ErrorHandler, if any.
`Layout<? extends Serializable>` | `getLayout()` Returns the Layout for the appender.
`String` | `getName()` Returns the name of the Appender.
`boolean` | `ignoreExceptions()` Some appenders need to propagate exceptions back to the application.
`static int` | `parseInt(String s, int defaultValue)`
`void` | `setHandler(ErrorHandler handler)` The handler must be set before the appender is started.
`String` | `toString()`

Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
`addFilter, getFilter, hasFilter, isFiltered, removeFilter, start, stop`

Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
`equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.apache.logging.log4j.core.Appender
`append`

Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
`getState, isStarted, isStopped, start, stop`

Constructor Detail

### AbstractAppender

    protected AbstractAppender(String name,
                               Filter filter,
                               Layout<? extends Serializable> layout)

  Constructor that defaults to suppressing exceptions.

  Parameters:
    `name` - The Appender name.
    `filter` - The Filter to associate with the Appender.
    `layout` - The layout to use to format the event.

### AbstractAppender

    protected AbstractAppender(String name,
                               Filter filter,
                               Layout<? extends Serializable> layout,
                               boolean ignoreExceptions)

  Constructor.

  Parameters:
    `name` - The Appender name.
    `filter` - The Filter to associate with the Appender.
    `layout` - The layout to use to format the event.
    `ignoreExceptions` - If true, exceptions will be logged and suppressed. If false errors will be logged and then passed to the application.

Method Detail

### parseInt

    public static int parseInt(String s,
                               int defaultValue)

### error

    public void error(String msg)

  Handle an error with a message using the `ErrorHandler` configured for this Appender.

  Parameters:
    `msg` - The message.

### error

    public void error(String msg,
                      LogEvent event,
                      Throwable t)

  Handle an error with a message, exception, and a logging event, using the `ErrorHandler` configured for this Appender.

  Parameters:
    `msg` - The message.
    `event` - The LogEvent.
    `t` - The Throwable.

### error

    public void error(String msg,
                      Throwable t)

  Handle an error with a message and an exception using the `ErrorHandler` configured for this Appender.

  Parameters:
    `msg` - The message.
    `t` - The Throwable.

### getHandler

    public ErrorHandler getHandler()

  Returns the ErrorHandler, if any.

  Specified by:
    `getHandler` in interface `Appender`
  Returns:
    The ErrorHandler.

### getLayout

    public Layout<? extends Serializable> getLayout()

  Returns the Layout for the appender.

  Specified by:
    `getLayout` in interface `Appender`
  Returns:
    The Layout used to format the event.

### getName

    public String getName()

  Returns the name of the Appender.

  Specified by:
    `getName` in interface `Appender`
  Returns:
    The name of the Appender.

### ignoreExceptions

    public boolean ignoreExceptions()

  Some appenders need to propagate exceptions back to the application. When `ignoreExceptions` is `false` the AppenderControl will allow the exception to percolate.

  Specified by:
    `ignoreExceptions` in interface `Appender`
  Returns:
    `true` if exceptions will be logged but now thrown, `false` otherwise.

### setHandler

    public void setHandler(ErrorHandler handler)

  The handler must be set before the appender is started.

  Specified by:
    `setHandler` in interface `Appender`
  Parameters:
    `handler` - The ErrorHandler to use.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.