Search in sources :

Example 11 with Property

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);
}
Also used : HashMap(java.util.HashMap) Property(org.apache.logging.log4j.core.config.Property)

Aggregations

Property (org.apache.logging.log4j.core.config.Property)11 HashMap (java.util.HashMap)3 Map (java.util.Map)2 LoggerContext (org.apache.logging.log4j.core.LoggerContext)2 AppenderRef (org.apache.logging.log4j.core.config.AppenderRef)2 Configuration (org.apache.logging.log4j.core.config.Configuration)2 LoggerConfig (org.apache.logging.log4j.core.config.LoggerConfig)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 HttpURLConnection (java.net.HttpURLConnection)1 URL (java.net.URL)1 HttpsURLConnection (javax.net.ssl.HttpsURLConnection)1 EmbeddedAgent (org.apache.flume.agent.embedded.EmbeddedAgent)1 Appender (org.apache.logging.log4j.core.Appender)1 LogEvent (org.apache.logging.log4j.core.LogEvent)1 ReliabilityStrategy (org.apache.logging.log4j.core.config.ReliabilityStrategy)1 PluginFactory (org.apache.logging.log4j.core.config.plugins.PluginFactory)1 Log4jLogEvent (org.apache.logging.log4j.core.impl.Log4jLogEvent)1 StringMap (org.apache.logging.log4j.util.StringMap)1