Class PropertiesPropertySource

java.lang.Object
org.apache.logging.log4j.util.PropertiesPropertySource
All Implemented Interfaces:
PropertySource
Direct Known Subclasses:
PropertyFilePropertySource

public class PropertiesPropertySource extends Object implements PropertySource
PropertySource backed by a Properties instance. Normalized property names follow a scheme like this: Log4jContextSelector would normalize to log4j2.contextSelector.
Since:
2.10.0
  • Field Details

  • Constructor Details

    • PropertiesPropertySource

      public PropertiesPropertySource(Properties properties)
  • Method Details

    • getPriority

      public int getPriority()
      Description copied from interface: PropertySource
      Returns the order in which this PropertySource has priority. A higher value means that the source will be applied later so as to take precedence over other property sources.
      Specified by:
      getPriority in interface PropertySource
      Returns:
      priority value
    • forEach

      public void forEach(BiConsumer<String,String> action)
      Description copied from interface: PropertySource
      Iterates over all properties and performs an action for each key/value pair.
      Specified by:
      forEach in interface PropertySource
      Parameters:
      action - action to perform on each key/value pair
    • getNormalForm

      public CharSequence getNormalForm(Iterable<? extends CharSequence> tokens)
      Description copied from interface: PropertySource
      Converts a list of property name tokens into a normal form. For example, a list of tokens such as "foo", "bar", "baz", might be normalized into the property name "log4j2.fooBarBaz".
      Specified by:
      getNormalForm in interface PropertySource
      Parameters:
      tokens - list of property name tokens
      Returns:
      a normalized property name using the given tokens