Java 类org.apache.logging.log4j.core.lookup.StrLookup 实例源码

项目:monarch    文件:LogService.java   
public static boolean isUsingGemFireDefaultConfig() {
  final Configuration config =
      ((org.apache.logging.log4j.core.Logger) LogManager.getLogger(ROOT_LOGGER_NAME,
          GemFireParameterizedMessageFactory.INSTANCE)).getContext().getConfiguration();

  final StrSubstitutor sub = config.getStrSubstitutor();
  final StrLookup resolver = sub.getVariableResolver();

  final String value = resolver.lookup(GEMFIRE_DEFAULT_PROPERTY);

  return "true".equals(value);
}
项目:log4j2    文件:PropertiesPlugin.java   
/**
 * Create the Properties component.
 * @param properties An array of Property elements.
 * @param config The Configuration.
 * @return An Interpolator that includes the configuration properties.
 */
@PluginFactory
public static StrLookup configureSubstitutor(@PluginElement("Properties") final Property[] properties,
                                             @PluginConfiguration final Configuration config) {
    if (properties == null) {
        return new Interpolator(null);
    }
    final Map<String, String> map = new HashMap<String, String>(config.getProperties());

    for (final Property prop : properties) {
        map.put(prop.getName(), prop.getValue());
    }

    return new Interpolator(new MapLookup(map));
}
项目:logging-log4j2    文件:PropertiesPlugin.java   
/**
 * Creates the Properties component.
 * @param properties An array of Property elements.
 * @param config The Configuration.
 * @return An Interpolator that includes the configuration properties.
 */
@PluginFactory
public static StrLookup configureSubstitutor(@PluginElement("Properties") final Property[] properties,
                                             @PluginConfiguration final Configuration config) {
    if (properties == null) {
        return new Interpolator(config.getProperties());
    }
    final Map<String, String> map = new HashMap<>(config.getProperties());

    for (final Property prop : properties) {
        map.put(prop.getName(), prop.getValue());
    }

    return new Interpolator(new MapLookup(map), config.getPluginPackages());
}