Package org.apache.log4j.rewrite

## Class RewriteAppender

- java.lang.Object
- - org.apache.log4j.AppenderSkeleton
  - - org.apache.log4j.rewrite.RewriteAppender

- All Implemented Interfaces:
    `org.apache.log4j.Appender`, `org.apache.log4j.spi.AppenderAttachable`, `org.apache.log4j.spi.OptionHandler`, `org.apache.log4j.xml.UnrecognizedElementHandler`

      public class RewriteAppender
      extends org.apache.log4j.AppenderSkeleton
      implements org.apache.log4j.spi.AppenderAttachable, org.apache.log4j.xml.UnrecognizedElementHandler

  This appender forwards a logging request to another appender after possibly rewriting the logging event.

  This appender (with the appropriate policy) replaces the MapFilter, PropertyFilter and ReflectionFilter from log4j 1.3.

- - ### Field Summary

    - ### Fields inherited from class org.apache.log4j.AppenderSkeleton

      `closed, errorHandler, headFilter, layout, name, tailFilter, threshold`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RewriteAppender()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addAppender​(org.apache.log4j.Appender newAppender)` | Add appender.
    `protected void` | `append​(org.apache.log4j.spi.LoggingEvent event)`
    `void` | `close()` | Close this `AsyncAppender` by interrupting the dispatcher thread which will process all pending events before exiting.
    `Enumeration` | `getAllAppenders()` | Get iterator over attached appenders.
    `org.apache.log4j.Appender` | `getAppender​(String name)` | Get appender by name.
    `boolean` | `isAttached​(org.apache.log4j.Appender appender)` | Determines if specified appender is attached.
    `boolean` | `parseUnrecognizedElement​(Element element, Properties props)`
    `void` | `removeAllAppenders()` | Removes and closes all attached appenders.
    `void` | `removeAppender​(String name)` | Remove appender by name.
    `void` | `removeAppender​(org.apache.log4j.Appender appender)` | Removes an appender.
    `boolean` | `requiresLayout()`
    `void` | `setRewritePolicy​(RewritePolicy rewritePolicy)` |

    - ### Methods inherited from class org.apache.log4j.AppenderSkeleton

      `activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RewriteAppender

          public RewriteAppender()

  - ### Method Detail

    - #### append

          protected void append​(org.apache.log4j.spi.LoggingEvent event)

      Specified by:
        `append` in class `org.apache.log4j.AppenderSkeleton`

    - #### addAppender

          public void addAppender​(org.apache.log4j.Appender newAppender)

      Add appender.
      Specified by:
        `addAppender` in interface `org.apache.log4j.spi.AppenderAttachable`
      Parameters:
        `newAppender` - appender to add, may not be null.

    - #### getAllAppenders

          public Enumeration getAllAppenders()

      Get iterator over attached appenders.
      Specified by:
        `getAllAppenders` in interface `org.apache.log4j.spi.AppenderAttachable`
      Returns:
        iterator or null if no attached appenders.

    - #### getAppender

          public org.apache.log4j.Appender getAppender​(String name)

      Get appender by name.
      Specified by:
        `getAppender` in interface `org.apache.log4j.spi.AppenderAttachable`
      Parameters:
        `name` - name, may not be null.
      Returns:
        matching appender or null.

    - #### close

          public void close()

      Close this `AsyncAppender` by interrupting the dispatcher thread which will process all pending events before exiting.
      Specified by:
        `close` in interface `org.apache.log4j.Appender`

    - #### isAttached

          public boolean isAttached​(org.apache.log4j.Appender appender)

      Determines if specified appender is attached.
      Specified by:
        `isAttached` in interface `org.apache.log4j.spi.AppenderAttachable`
      Parameters:
        `appender` - appender.
      Returns:
        true if attached.

    - #### requiresLayout

          public boolean requiresLayout()

      Specified by:
        `requiresLayout` in interface `org.apache.log4j.Appender`

    - #### removeAllAppenders

          public void removeAllAppenders()

      Removes and closes all attached appenders.
      Specified by:
        `removeAllAppenders` in interface `org.apache.log4j.spi.AppenderAttachable`

    - #### removeAppender

          public void removeAppender​(org.apache.log4j.Appender appender)

      Removes an appender.
      Specified by:
        `removeAppender` in interface `org.apache.log4j.spi.AppenderAttachable`
      Parameters:
        `appender` - appender to remove.

    - #### removeAppender

          public void removeAppender​(String name)

      Remove appender by name.
      Specified by:
        `removeAppender` in interface `org.apache.log4j.spi.AppenderAttachable`
      Parameters:
        `name` - name.

    - #### setRewritePolicy

          public void setRewritePolicy​(RewritePolicy rewritePolicy)

    - #### parseUnrecognizedElement

          public boolean parseUnrecognizedElement​(Element element,
                                                  Properties props)
                                           throws Exception

      Specified by:
        `parseUnrecognizedElement` in interface `org.apache.log4j.xml.UnrecognizedElementHandler`
      Throws:
        `Exception`