org.apache.logging.log4j.core.config.Configuration.getProperties()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中org.apache.logging.log4j.core.config.Configuration.getProperties()方法的一些代码示例,展示了Configuration.getProperties()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getProperties()方法的具体详情如下:
包路径:org.apache.logging.log4j.core.config.Configuration
类名称:Configuration
方法名:getProperties

Configuration.getProperties介绍

暂无

代码示例

代码示例来源:origin: alipay/sofa-common-tools

private boolean isAlreadyReInitialized(LoggerContext loggerContext) {
  if (loggerContext.getConfiguration().getProperties()
    .get(DefaultLog4j2ReInitializer.class.getCanonicalName()) != null) {
    return true;
  }
  return false;
}

代码示例来源:origin: alipay/sofa-common-tools

private void markAsReInitialized(LoggerContext loggerContext) {
  loggerContext.getConfiguration().getProperties()
    .put(DefaultLog4j2ReInitializer.class.getCanonicalName(), "");
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public Map<String, String> getConfigProperties() {
  return getConfig().getProperties();
}

代码示例来源:origin: alipay/sofa-common-tools

config.getProperties().put((String) entry.getKey(), (String) entry.getValue());

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public PatternFormatter[] getFormatters(final LogEvent event) {
  final SimpleBindings bindings = new SimpleBindings();
  bindings.putAll(configuration.getProperties());
  bindings.put("substitutor", configuration.getStrSubstitutor());
  bindings.put("logEvent", event);
  final Object object = configuration.getScriptManager().execute(script.getName(), bindings);
  if (object == null) {
    return defaultFormatters;
  }
  final PatternFormatter[] patternFormatter = formatterMap.get(object.toString());
  return patternFormatter == null ? defaultFormatters : patternFormatter;
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public Result filter(final LogEvent event) {
  final SimpleBindings bindings = new SimpleBindings();
  bindings.put("logEvent", event);
  bindings.putAll(configuration.getProperties());
  bindings.put("substitutor", configuration.getStrSubstitutor());
  final Object object = configuration.getScriptManager().execute(script.getName(), bindings);
  return object == null || !Boolean.TRUE.equals(object) ? onMismatch : onMatch;
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

/**
   * 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());
  }
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public Result filter(final Logger logger, final Level level, final Marker marker, final Message msg,
           final Throwable t) {
  final SimpleBindings bindings = new SimpleBindings();
  bindings.put("logger", logger);
  bindings.put("level", level);
  bindings.put("marker", marker);
  bindings.put("message", msg);
  bindings.put("parameters", null);
  bindings.put("throwable", t);
  bindings.putAll(configuration.getProperties());
  bindings.put("substitutor", configuration.getStrSubstitutor());
  final Object object = configuration.getScriptManager().execute(script.getName(), bindings);
  return object == null || !Boolean.TRUE.equals(object) ? onMismatch : onMatch;
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public Result filter(final Logger logger, final Level level, final Marker marker, final String msg,
           final Object... params) {
  final SimpleBindings bindings = new SimpleBindings();
  bindings.put("logger", logger);
  bindings.put("level", level);
  bindings.put("marker", marker);
  bindings.put("message", new SimpleMessage(msg));
  bindings.put("parameters", params);
  bindings.put("throwable", null);
  bindings.putAll(configuration.getProperties());
  bindings.put("substitutor", configuration.getStrSubstitutor());
  final Object object = configuration.getScriptManager().execute(script.getName(), bindings);
  return object == null || !Boolean.TRUE.equals(object) ? onMismatch : onMatch;
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public Result filter(final Logger logger, final Level level, final Marker marker, final Object msg,
           final Throwable t) {
  final SimpleBindings bindings = new SimpleBindings();
  bindings.put("logger", logger);
  bindings.put("level", level);
  bindings.put("marker", marker);
  bindings.put("message", msg instanceof String ? new SimpleMessage((String)msg) : new ObjectMessage(msg));
  bindings.put("parameters", null);
  bindings.put("throwable", t);
  bindings.putAll(configuration.getProperties());
  bindings.put("substitutor", configuration.getStrSubstitutor());
  final Object object = configuration.getScriptManager().execute(script.getName(), bindings);
  return object == null || !Boolean.TRUE.equals(object) ? onMismatch : onMatch;
}

代码示例来源:origin: alipay/sofa-common-tools

loggerContext, source);
for (Map.Entry entry : properties.entrySet()) {
  config.getProperties().put((String) entry.getKey(), (String) entry.getValue());

代码示例来源:origin: ops4j/org.ops4j.pax.logging

/**
 * Executes the script
 * 
 * @param baseDir
 * @param candidates
 * @return
 */
@SuppressWarnings("unchecked")
public List<PathWithAttributes> selectFilesToDelete(final Path basePath, final List<PathWithAttributes> candidates) {
  final SimpleBindings bindings = new SimpleBindings();
  bindings.put("basePath", basePath);
  bindings.put("pathList", candidates);
  bindings.putAll(configuration.getProperties());
  bindings.put("configuration", configuration);
  bindings.put("substitutor", configuration.getStrSubstitutor());
  bindings.put("statusLogger", LOGGER);
  final Object object = configuration.getScriptManager().execute(script.getName(), bindings);
  return (List<PathWithAttributes>) object;
}

相关文章