use of org.apache.logging.log4j.core.config.Property in project logging-log4j2 by apache.
the class ThreadContextBenchmark method createMap.
// from Log4jLogEvent::createMap
static Map<String, String> createMap(final List<Property> properties) {
final Map<String, String> contextMap = ThreadContext.getImmutableContext();
if (properties == null || properties.isEmpty()) {
// may be ThreadContext.EMPTY_MAP but not null
return contextMap;
}
final Map<String, String> map = new HashMap<>(contextMap);
for (final Property prop : properties) {
if (!map.containsKey(prop.getName())) {
map.put(prop.getName(), prop.getValue());
}
}
return Collections.unmodifiableMap(map);
}
Aggregations