org.apache.log4j.rewrite

## Class MapRewritePolicy

- java.lang.Object
- - org.apache.log4j.rewrite.MapRewritePolicy

- All Implemented Interfaces:
    RewritePolicy

      public class MapRewritePolicy
      extends Object
      implements RewritePolicy

  This policy rewrites events where the message of the original event implementes java.util.Map. All other events are passed through unmodified. If the map contains a "message" entry, the value will be used as the message for the rewritten event. The rewritten event will have a property set that is the combination of the original property set and the other members of the message map. If both the original property set and the message map contain the same entry, the value from the message map will overwrite the original property set. The combination of the RewriteAppender and this policy performs the same actions as the MapFilter from log4j 1.3.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapRewritePolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.log4j.spi.LoggingEvent` | `rewrite(org.apache.log4j.spi.LoggingEvent source)` Rewrite a logging event.

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

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

- - ### Constructor Detail

    - #### MapRewritePolicy

          public MapRewritePolicy()

  - ### Method Detail

    - #### rewrite

          public org.apache.log4j.spi.LoggingEvent rewrite(org.apache.log4j.spi.LoggingEvent source)

      Rewrite a logging event.
      Specified by:
        `rewrite` in interface `RewritePolicy`
      Parameters:
        `source` - a logging event that may be returned or used to create a new logging event.
      Returns:
        a logging event or null to suppress processing.

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