Class PropertyRewritePolicy

  • All Implemented Interfaces:
    RewritePolicy

    public class PropertyRewritePolicy
    extends java.lang.Object
    implements RewritePolicy
    This policy rewrites events by adding a user-specified list of properties to the event. Existing properties are not modified.

    The combination of the RewriteAppender and this policy performs the same actions as the PropertyFilter from log4j 1.3.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.lang.String> properties  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.Thread getThread​(java.lang.String name)  
      LoggingEvent rewrite​(LoggingEvent source)
      Rewrite a logging event.
      void setProperties​(java.lang.String properties)
      Set a string representing the property name/value pairs.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • properties

        private java.util.Map<java.lang.String,​java.lang.String> properties
    • Constructor Detail

      • PropertyRewritePolicy

        public PropertyRewritePolicy()
    • Method Detail

      • setProperties

        public void setProperties​(java.lang.String properties)
        Set a string representing the property name/value pairs.

        Form:

         propname1=propvalue1,propname2=propvalue2
         
        Parameters:
        properties - The properties.
      • rewrite

        public LoggingEvent rewrite​(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.
      • getThread

        private java.lang.Thread getThread​(java.lang.String name)