You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2014/05/21 18:31:19 UTC

svn commit: r1596613 [2/5] - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/appender/ log4j-core/src/main/java/org/apache/logging/log4j/core/appender/jms/ log4j-core/src/main/java/org/apache/logging/log4j/core/ap...

Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java?rev=1596613&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java Wed May 21 16:31:17 2014
@@ -0,0 +1,722 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.layout;
+
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LoggingException;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.TlsSyslogFrame;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
+import org.apache.logging.log4j.core.config.plugins.PluginElement;
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.net.Facility;
+import org.apache.logging.log4j.core.net.Priority;
+import org.apache.logging.log4j.core.pattern.LogEventPatternConverter;
+import org.apache.logging.log4j.core.pattern.PatternConverter;
+import org.apache.logging.log4j.core.pattern.PatternFormatter;
+import org.apache.logging.log4j.core.pattern.PatternParser;
+import org.apache.logging.log4j.core.pattern.ThrowablePatternConverter;
+import org.apache.logging.log4j.core.util.Booleans;
+import org.apache.logging.log4j.core.util.Charsets;
+import org.apache.logging.log4j.core.util.Integers;
+import org.apache.logging.log4j.core.util.NetUtils;
+import org.apache.logging.log4j.core.util.Patterns;
+import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.message.StructuredDataId;
+import org.apache.logging.log4j.message.StructuredDataMessage;
+import org.apache.logging.log4j.util.Strings;
+
+
+/**
+ * Formats a log event in accordance with RFC 5424.
+ *
+ * @see <a href="https://tools.ietf.org/html/rfc5424">RFC 5424</a>
+ */
+@Plugin(name = "Rfc5424Layout", category = "Core", elementType = "layout", printObject = true)
+public final class Rfc5424Layout extends AbstractStringLayout {
+
+    private static final String LF = "\n";
+
+    /**
+     * Not a very good default - it is the Apache Software Foundation's enterprise number.
+     */
+    public static final int DEFAULT_ENTERPRISE_NUMBER = 18060;
+    /**
+     * The default event id.
+     */
+    public static final String DEFAULT_ID = "Audit";
+    /**
+     * Match newlines in a platform-independent manner.
+     */
+    public static final Pattern NEWLINE_PATTERN = Pattern.compile("\\r?\\n");
+    /**
+     * Match characters which require escaping
+     */
+    public static final Pattern PARAM_VALUE_ESCAPE_PATTERN = Pattern.compile("[\\\"\\]\\\\]");
+
+    protected static final String DEFAULT_MDCID = "mdc";
+    private static final int TWO_DIGITS = 10;
+    private static final int THREE_DIGITS = 100;
+    private static final int MILLIS_PER_MINUTE = 60000;
+    private static final int MINUTES_PER_HOUR = 60;
+
+    private static final String COMPONENT_KEY = "RFC5424-Converter";
+
+    private final Facility facility;
+    private final String defaultId;
+    private final int enterpriseNumber;
+    private final boolean includeMDC;
+    private final String mdcId;
+    private final StructuredDataId mdcSDID;
+    private final String localHostName;
+    private final String appName;
+    private final String messageId;
+    private final String configName;
+    private final String mdcPrefix;
+    private final String eventPrefix;
+    private final List<String> mdcExcludes;
+    private final List<String> mdcIncludes;
+    private final List<String> mdcRequired;
+    private final ListChecker checker;
+    private final ListChecker noopChecker = new NoopChecker();
+    private final boolean includeNewLine;
+    private final String escapeNewLine;
+    private final boolean useTLSMessageFormat;
+
+    private long lastTimestamp = -1;
+    private String timestamppStr;
+
+    private final List<PatternFormatter> exceptionFormatters;
+    private final Map<String,  FieldFormatter> fieldFormatters;
+
+    private Rfc5424Layout(final Configuration config, final Facility facility, final String id, final int ein,
+                          final boolean includeMDC, final boolean includeNL, final String escapeNL, final String mdcId,
+                          final String mdcPrefix, final String eventPrefix,
+                          final String appName, final String messageId, final String excludes, final String includes,
+                          final String required, final Charset charset, final String exceptionPattern,
+                          final boolean useTLSMessageFormat, final LoggerFields[] loggerFields) {
+        super(charset);
+        final PatternParser exceptionParser = createPatternParser(config, ThrowablePatternConverter.class);
+        exceptionFormatters = exceptionPattern == null ? null : exceptionParser.parse(exceptionPattern, false, false);
+        this.facility = facility;
+        this.defaultId = id == null ? DEFAULT_ID : id;
+        this.enterpriseNumber = ein;
+        this.includeMDC = includeMDC;
+        this.includeNewLine = includeNL;
+        this.escapeNewLine = escapeNL == null ? null : Matcher.quoteReplacement(escapeNL);
+        this.mdcId = mdcId;
+        this.mdcSDID = new StructuredDataId(mdcId, enterpriseNumber, null, null);
+        this.mdcPrefix = mdcPrefix;
+        this.eventPrefix = eventPrefix;
+        this.appName = appName;
+        this.messageId = messageId;
+        this.useTLSMessageFormat = useTLSMessageFormat;
+        this.localHostName = NetUtils.getLocalHostname();
+        ListChecker c = null;
+        if (excludes != null) {
+            final String[] array = excludes.split(Patterns.COMMA_SEPARATOR);
+            if (array.length > 0) {
+                c = new ExcludeChecker();
+                mdcExcludes = new ArrayList<String>(array.length);
+                for (final String str : array) {
+                    mdcExcludes.add(str.trim());
+                }
+            } else {
+                mdcExcludes = null;
+            }
+        } else {
+            mdcExcludes = null;
+        }
+        if (includes != null) {
+            final String[] array = includes.split(Patterns.COMMA_SEPARATOR);
+            if (array.length > 0) {
+                c = new IncludeChecker();
+                mdcIncludes = new ArrayList<String>(array.length);
+                for (final String str : array) {
+                    mdcIncludes.add(str.trim());
+                }
+            } else {
+                mdcIncludes = null;
+            }
+        } else {
+            mdcIncludes = null;
+        }
+        if (required != null) {
+            final String[] array = required.split(Patterns.COMMA_SEPARATOR);
+            if (array.length > 0) {
+                mdcRequired = new ArrayList<String>(array.length);
+                for (final String str : array) {
+                    mdcRequired.add(str.trim());
+                }
+            } else {
+                mdcRequired = null;
+            }
+
+        } else {
+            mdcRequired = null;
+        }
+        this.checker = c != null ? c : noopChecker;
+        final String name = config == null ? null : config.getName();
+        configName = name != null && name.length() > 0 ? name : null;
+        this.fieldFormatters = createFieldFormatters(loggerFields, config);
+    }
+
+    private Map<String, FieldFormatter> createFieldFormatters(final LoggerFields[] loggerFields,
+            final Configuration config) {
+        final Map<String, FieldFormatter> sdIdMap = new HashMap<String, FieldFormatter>();
+
+        if (loggerFields != null) {
+            for (final LoggerFields lField : loggerFields) {
+                final StructuredDataId key = lField.getSdId() == null ? mdcSDID : lField.getSdId();
+                final Map<String, List<PatternFormatter>> sdParams = new HashMap<String, List<PatternFormatter>>();
+                final Map<String, String> fields = lField.getMap();
+                if (!fields.isEmpty()) {
+                    final PatternParser fieldParser = createPatternParser(config, null);
+
+                    for (final Map.Entry<String, String> entry : fields.entrySet()) {
+                        final List<PatternFormatter> formatters = fieldParser.parse(entry.getValue(), false, false);
+                        sdParams.put(entry.getKey(), formatters);
+                    }
+                    final FieldFormatter fieldFormatter = new FieldFormatter(sdParams,
+                            lField.getDiscardIfAllFieldsAreEmpty());
+                    sdIdMap.put(key.toString(), fieldFormatter);
+                }
+            }
+        }
+        return sdIdMap.size() > 0 ? sdIdMap : null;
+    }
+
+    /**
+     * Create a PatternParser.
+     *
+     * @param config The Configuration.
+     * @param filterClass Filter the returned plugins after calling the plugin manager.
+     * @return The PatternParser.
+     */
+    private static PatternParser createPatternParser(final Configuration config,
+            final Class<? extends PatternConverter> filterClass) {
+        if (config == null) {
+            return new PatternParser(config, PatternLayout.KEY, LogEventPatternConverter.class, filterClass);
+        }
+        PatternParser parser = config.getComponent(COMPONENT_KEY);
+        if (parser == null) {
+            parser = new PatternParser(config, PatternLayout.KEY, ThrowablePatternConverter.class);
+            config.addComponent(COMPONENT_KEY, parser);
+            parser = (PatternParser) config.getComponent(COMPONENT_KEY);
+        }
+        return parser;
+    }
+
+    /**
+     * Rfc5424Layout's content format is specified by:<p/>
+     * Key: "structured" Value: "true"<p/>
+     * Key: "format" Value: "RFC5424"<p/>
+     *
+     * @return Map of content format keys supporting Rfc5424Layout
+     */
+    @Override
+    public Map<String, String> getContentFormat() {
+        final Map<String, String> result = new HashMap<String, String>();
+        result.put("structured", "true");
+        result.put("formatType", "RFC5424");
+        return result;
+    }
+
+    /**
+     * Formats a {@link org.apache.logging.log4j.core.LogEvent} in conformance with the RFC 5424 Syslog specification.
+     *
+     * @param event The LogEvent.
+     * @return The RFC 5424 String representation of the LogEvent.
+     */
+    @Override
+    public String toSerializable(final LogEvent event) {
+        final StringBuilder buf = new StringBuilder();
+        appendPriority(buf, event.getLevel());
+        appendTimestamp(buf, event.getTimeMillis());
+        appendSpace(buf);
+        appendHostName(buf);
+        appendSpace(buf);
+        appendAppName(buf);
+        appendSpace(buf);
+        appendProcessId(buf);
+        appendSpace(buf);
+        appendMessageId(buf, event.getMessage());
+        appendSpace(buf);
+        appendStructuredElements(buf, event);
+        appendMessage(buf, event);
+        if (useTLSMessageFormat) {
+            return new TlsSyslogFrame(buf.toString()).toString();
+        }
+        return buf.toString();
+    }
+
+    private void appendPriority(final StringBuilder buffer, final Level logLevel) {
+        buffer.append('<');
+        buffer.append(Priority.getPriority(facility, logLevel));
+        buffer.append(">1 ");
+    }
+
+    private void appendTimestamp(final StringBuilder buffer, final long milliseconds)  {
+        buffer.append(computeTimeStampString(milliseconds));
+    }
+
+    private void appendSpace(final StringBuilder buffer) {
+        buffer.append(' ');
+    }
+
+    private void appendHostName(final StringBuilder buffer) {
+        buffer.append(localHostName);
+    }
+
+    private void appendAppName(final StringBuilder buffer) {
+        if (appName != null) {
+            buffer.append(appName);
+        } else if (configName != null) {
+            buffer.append(configName);
+        } else {
+            buffer.append('-');
+        }
+    }
+
+    private void appendProcessId(final StringBuilder buffer) {
+        buffer.append(getProcId());
+    }
+
+    private void appendMessageId(final StringBuilder buffer, final Message message) {
+        final boolean isStructured = message instanceof StructuredDataMessage;
+        final String type = isStructured ? ((StructuredDataMessage) message).getType() : null;
+        if (type != null) {
+            buffer.append(type);
+        } else if (messageId != null) {
+            buffer.append(messageId);
+        } else {
+            buffer.append('-');
+        }
+    }
+
+    private void appendMessage(final StringBuilder buffer, final LogEvent event) {
+        final Message message = event.getMessage();
+        // This layout formats StructuredDataMessages instead of delegating to the Message itself.
+        final String text = (message instanceof StructuredDataMessage) ? message.getFormat() : message.getFormattedMessage();
+
+        if (text != null && text.length() > 0) {
+            buffer.append(' ').append(escapeNewlines(text, escapeNewLine));
+        }
+
+        if (exceptionFormatters != null && event.getThrown() != null) {
+            final StringBuilder exception = new StringBuilder(LF);
+            for (final PatternFormatter formatter : exceptionFormatters) {
+                formatter.format(event, exception);
+            }
+            buffer.append(escapeNewlines(exception.toString(), escapeNewLine));
+        }
+        if (includeNewLine) {
+            buffer.append(LF);
+        }
+    }
+
+    private void appendStructuredElements(final StringBuilder buffer, final LogEvent event) {
+        final Message message = event.getMessage();
+        final boolean isStructured = message instanceof StructuredDataMessage;
+
+        if (!isStructured && (fieldFormatters!= null && fieldFormatters.size() == 0) && !includeMDC) {
+            buffer.append('-');
+            return;
+        }
+
+        final Map<String, StructuredDataElement> sdElements = new HashMap<String, StructuredDataElement>();
+        final Map<String, String> contextMap = event.getContextMap();
+
+        if (mdcRequired != null) {
+            checkRequired(contextMap);
+        }
+
+        if (fieldFormatters != null) {
+            for (final Map.Entry<String, FieldFormatter> sdElement: fieldFormatters.entrySet()) {
+                final String sdId = sdElement.getKey();
+                final StructuredDataElement elem = sdElement.getValue().format(event);
+                sdElements.put(sdId, elem);
+            }
+        }
+
+        if (includeMDC && contextMap.size() > 0) {
+            if (sdElements.containsKey(mdcSDID.toString())) {
+                final StructuredDataElement union = sdElements.get(mdcSDID.toString());
+                union.union(contextMap);
+                sdElements.put(mdcSDID.toString(), union);
+            } else {
+                final StructuredDataElement formattedContextMap = new StructuredDataElement(contextMap, false);
+                sdElements.put(mdcSDID.toString(), formattedContextMap);
+            }
+        }
+
+        if (isStructured) {
+            final StructuredDataMessage data = (StructuredDataMessage) message;
+            final Map<String, String> map = data.getData();
+            final StructuredDataId id = data.getId();
+            final String sdId = getId(id);
+
+            if (sdElements.containsKey(sdId)) {
+                final StructuredDataElement union = sdElements.get(id.toString());
+                union.union(map);
+                sdElements.put(sdId, union);
+            } else {
+                final StructuredDataElement formattedData = new StructuredDataElement(map, false);
+                sdElements.put(sdId, formattedData);
+            }
+        }
+
+        if (sdElements.size() == 0) {
+            buffer.append('-');
+            return;
+        }
+
+        for (final Map.Entry<String, StructuredDataElement> entry: sdElements.entrySet()) {
+            formatStructuredElement(entry.getKey(), mdcPrefix, entry.getValue(), buffer, checker);
+        }
+    }
+
+    private String escapeNewlines(final String text, final String escapeNewLine) {
+        if (null == escapeNewLine) {
+            return text;
+        }
+        return NEWLINE_PATTERN.matcher(text).replaceAll(escapeNewLine);
+    }
+
+    protected String getProcId() {
+        return "-";
+    }
+
+    protected List<String> getMdcExcludes() {
+        return mdcExcludes;
+    }
+
+    protected List<String> getMdcIncludes() {
+        return mdcIncludes;
+    }
+
+    private String computeTimeStampString(final long now) {
+        long last;
+        synchronized (this) {
+            last = lastTimestamp;
+            if (now == lastTimestamp) {
+                return timestamppStr;
+            }
+        }
+
+        final StringBuilder buffer = new StringBuilder();
+        final Calendar cal = new GregorianCalendar();
+        cal.setTimeInMillis(now);
+        buffer.append(Integer.toString(cal.get(Calendar.YEAR)));
+        buffer.append('-');
+        pad(cal.get(Calendar.MONTH) + 1, TWO_DIGITS, buffer);
+        buffer.append('-');
+        pad(cal.get(Calendar.DAY_OF_MONTH), TWO_DIGITS, buffer);
+        buffer.append('T');
+        pad(cal.get(Calendar.HOUR_OF_DAY), TWO_DIGITS, buffer);
+        buffer.append(':');
+        pad(cal.get(Calendar.MINUTE), TWO_DIGITS, buffer);
+        buffer.append(':');
+        pad(cal.get(Calendar.SECOND), TWO_DIGITS, buffer);
+
+        final int millis = cal.get(Calendar.MILLISECOND);
+        if (millis != 0) {
+            buffer.append('.');
+            pad(millis, THREE_DIGITS, buffer);
+        }
+
+        int tzmin = (cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)) / MILLIS_PER_MINUTE;
+        if (tzmin == 0) {
+            buffer.append('Z');
+        } else {
+            if (tzmin < 0) {
+                tzmin = -tzmin;
+                buffer.append('-');
+            } else {
+                buffer.append('+');
+            }
+            final int tzhour = tzmin / MINUTES_PER_HOUR;
+            tzmin -= tzhour * MINUTES_PER_HOUR;
+            pad(tzhour, TWO_DIGITS, buffer);
+            buffer.append(':');
+            pad(tzmin, TWO_DIGITS, buffer);
+        }
+        synchronized (this) {
+            if (last == lastTimestamp) {
+                lastTimestamp = now;
+                timestamppStr = buffer.toString();
+            }
+        }
+        return buffer.toString();
+    }
+
+    private void pad(final int val, int max, final StringBuilder buf) {
+        while (max > 1) {
+            if (val < max) {
+                buf.append('0');
+            }
+            max = max / TWO_DIGITS;
+        }
+        buf.append(Integer.toString(val));
+    }
+
+    private void formatStructuredElement(final String id, final String prefix, final StructuredDataElement data,
+                                         final StringBuilder sb, final ListChecker checker) {
+        if ((id == null && defaultId == null) || data.discard()) {
+            return;
+        }
+
+        sb.append('[');
+        sb.append(id);
+        if (!mdcSDID.toString().equals(id)) {
+            appendMap(prefix, data.getFields(), sb, noopChecker);
+        } else {
+            appendMap(prefix, data.getFields(), sb, checker);
+        }
+        sb.append(']');
+    }
+
+    private String getId(final StructuredDataId id) {
+        final StringBuilder sb = new StringBuilder();
+        if (id == null || id.getName() == null) {
+            sb.append(defaultId);
+        } else {
+            sb.append(id.getName());
+        }
+        int ein = id != null ? id.getEnterpriseNumber() : enterpriseNumber;
+        if (ein < 0) {
+            ein = enterpriseNumber;
+        }
+        if (ein >= 0) {
+            sb.append('@').append(ein);
+        }
+        return sb.toString();
+    }
+
+    private void checkRequired(final Map<String, String> map) {
+        for (final String key : mdcRequired) {
+            final String value = map.get(key);
+            if (value == null) {
+                throw new LoggingException("Required key " + key + " is missing from the " + mdcId);
+            }
+        }
+    }
+
+    private void appendMap(final String prefix, final Map<String, String> map, final StringBuilder sb,
+                           final ListChecker checker) {
+        final SortedMap<String, String> sorted = new TreeMap<String, String>(map);
+        for (final Map.Entry<String, String> entry : sorted.entrySet()) {
+            if (checker.check(entry.getKey()) && entry.getValue() != null) {
+                sb.append(' ');
+                if (prefix != null) {
+                    sb.append(prefix);
+                }
+                sb.append(escapeNewlines(escapeSDParams(entry.getKey()), escapeNewLine)).append("=\"")
+                    .append(escapeNewlines(escapeSDParams(entry.getValue()), escapeNewLine)).append('"');
+            }
+        }
+    }
+
+    private String escapeSDParams(final String value) {
+        return PARAM_VALUE_ESCAPE_PATTERN.matcher(value).replaceAll("\\\\$0");
+    }
+
+    /**
+     * Interface used to check keys in a Map.
+     */
+    private interface ListChecker {
+        boolean check(String key);
+    }
+
+    /**
+     * Includes only the listed keys.
+     */
+    private class IncludeChecker implements ListChecker {
+        @Override
+        public boolean check(final String key) {
+            return mdcIncludes.contains(key);
+        }
+    }
+
+    /**
+     * Excludes the listed keys.
+     */
+    private class ExcludeChecker implements ListChecker {
+        @Override
+        public boolean check(final String key) {
+            return !mdcExcludes.contains(key);
+        }
+    }
+
+    /**
+     * Does nothing.
+     */
+    private class NoopChecker implements ListChecker {
+        @Override
+        public boolean check(final String key) {
+            return true;
+        }
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("facility=").append(facility.name());
+        sb.append(" appName=").append(appName);
+        sb.append(" defaultId=").append(defaultId);
+        sb.append(" enterpriseNumber=").append(enterpriseNumber);
+        sb.append(" newLine=").append(includeNewLine);
+        sb.append(" includeMDC=").append(includeMDC);
+        sb.append(" messageId=").append(messageId);
+        return sb.toString();
+    }
+
+    /**
+     * Create the RFC 5424 Layout.
+     *
+     * @param facility         The Facility is used to try to classify the message.
+     * @param id               The default structured data id to use when formatting according to RFC 5424.
+     * @param ein              The IANA enterprise number.
+     * @param includeMDC       Indicates whether data from the ThreadContextMap will be included in the RFC 5424 Syslog
+     *                         record. Defaults to "true:.
+     * @param mdcId            The id to use for the MDC Structured Data Element.
+     * @param mdcPrefix        The prefix to add to MDC key names.
+     * @param eventPrefix      The prefix to add to event key names.
+     * @param includeNL        If true, a newline will be appended to the end of the syslog record. The default is false.
+     * @param escapeNL         String that should be used to replace newlines within the message text.
+     * @param appName          The value to use as the APP-NAME in the RFC 5424 syslog record.
+     * @param msgId            The default value to be used in the MSGID field of RFC 5424 syslog records.
+     * @param excludes         A comma separated list of MDC keys that should be excluded from the LogEvent.
+     * @param includes         A comma separated list of MDC keys that should be included in the FlumeEvent.
+     * @param required         A comma separated list of MDC keys that must be present in the MDC.
+     * @param exceptionPattern The pattern for formatting exceptions.
+     * @param useTLSMessageFormat If true the message will be formatted according to RFC 5425.
+     * @param loggerFields     Container for the KeyValuePairs containing the patterns
+     * @param config           The Configuration. Some Converters require access to the Interpolator.
+     * @return An Rfc5424Layout.
+     */
+    @PluginFactory
+    public static Rfc5424Layout createLayout(
+            @PluginAttribute("facility") final String facility,
+            @PluginAttribute("id") final String id,
+            @PluginAttribute("enterpriseNumber") final String ein,
+            @PluginAttribute("includeMDC") final String includeMDC,
+            @PluginAttribute("mdcId") String mdcId,
+            @PluginAttribute("mdcPrefix") final String mdcPrefix,
+            @PluginAttribute("eventPrefix") final String eventPrefix,
+            @PluginAttribute("newLine") final String includeNL,
+            @PluginAttribute("newLineEscape") final String escapeNL,
+            @PluginAttribute("appName") final String appName,
+            @PluginAttribute("messageId") final String msgId,
+            @PluginAttribute("mdcExcludes") final String excludes,
+            @PluginAttribute("mdcIncludes") String includes,
+            @PluginAttribute("mdcRequired") final String required,
+            @PluginAttribute("exceptionPattern") final String exceptionPattern,
+            @PluginAttribute("useTLSMessageFormat") final String useTLSMessageFormat, // RFC 5425
+            @PluginElement("LoggerFields") final LoggerFields[] loggerFields,
+            @PluginConfiguration final Configuration config) {
+        final Charset charset = Charsets.UTF_8;
+        if (includes != null && excludes != null) {
+            LOGGER.error("mdcIncludes and mdcExcludes are mutually exclusive. Includes wil be ignored");
+            includes = null;
+        }
+        final Facility f = Facility.toFacility(facility, Facility.LOCAL0);
+        final int enterpriseNumber = Integers.parseInt(ein, DEFAULT_ENTERPRISE_NUMBER);
+        final boolean isMdc = Booleans.parseBoolean(includeMDC, true);
+        final boolean includeNewLine = Boolean.parseBoolean(includeNL);
+        final boolean useTlsMessageFormat = Booleans.parseBoolean(useTLSMessageFormat, false);
+        if (mdcId == null) {
+            mdcId = DEFAULT_MDCID;
+        }
+
+        return new Rfc5424Layout(config, f, id, enterpriseNumber, isMdc, includeNewLine, escapeNL, mdcId, mdcPrefix,
+                eventPrefix, appName, msgId, excludes, includes, required, charset, exceptionPattern,
+                useTlsMessageFormat, loggerFields);
+    }
+
+    private class FieldFormatter {
+
+        private final Map<String, List<PatternFormatter>> delegateMap;
+        private final boolean discardIfEmpty;
+
+        public FieldFormatter(final Map<String, List<PatternFormatter>> fieldMap, final boolean discardIfEmpty) {
+            this.discardIfEmpty = discardIfEmpty;
+            this.delegateMap = fieldMap;
+        }
+
+        public StructuredDataElement format(final LogEvent event) {
+            final Map<String, String> map = new HashMap<String, String>();
+
+            for (final Map.Entry<String, List<PatternFormatter>> entry : delegateMap.entrySet()) {
+                final StringBuilder buffer = new StringBuilder();
+                for (final PatternFormatter formatter : entry.getValue()) {
+                    formatter.format(event, buffer);
+                }
+                map.put(entry.getKey(), buffer.toString());
+            }
+            return new StructuredDataElement(map, discardIfEmpty);
+        }
+    }
+
+    private class StructuredDataElement {
+
+        private final Map<String, String> fields;
+        private final boolean discardIfEmpty;
+
+        public StructuredDataElement(final Map<String, String> fields, final boolean discardIfEmpty) {
+            this.discardIfEmpty = discardIfEmpty;
+            this.fields = fields;
+        }
+
+        boolean discard() {
+            if (discardIfEmpty == false) {
+                return false;
+            }
+            boolean foundNotEmptyValue = false;
+            for (final Map.Entry<String, String> entry : fields.entrySet()) {
+                if (Strings.isNotEmpty(entry.getValue())) {
+                    foundNotEmptyValue = true;
+                    break;
+                }
+            }
+            return !foundNotEmptyValue;
+        }
+
+        void union(final Map<String, String> fields) {
+            this.fields.putAll(fields);
+        }
+
+        Map<String, String> getFields() {
+            return this.fields;
+        }
+    }
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java?rev=1596613&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java Wed May 21 16:31:17 2014
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.layout;
+
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.jackson.XMLConstants;
+import org.apache.logging.log4j.core.util.Charsets;
+
+/**
+ * Appends a series of {@code event} elements as defined in the <a href="log4j.dtd">log4j.dtd</a>.
+ * 
+ * <h4>Complete well-formed XML vs. fragment XML</h4>
+ * <p>
+ * If you configure {@code complete="true"}, the appender outputs a well-formed XML document where the default namespace is the log4j
+ * namespace {@value XMLConstants#XML_NAMESPACE}. By default, with {@code complete="false"}, you should include the output as an
+ * <em>external entity</em> in a separate file to form a well-formed XML document.
+ * </p>
+ * <p>
+ * A well-formed XML document follows this pattern:
+ * </p>
+ * <pre>
+&lt;Event xmlns=&quot;http://logging.apache.org/log4j/2.0/events&quot; timeMillis=&quot;1&quot; thread=&quot;MyThreadName&quot; level=&quot;DEBUG&quot; loggerName=&quot;a.B&quot; loggerFQCN=&quot;f.q.c.n&quot; endOfBatch=&quot;false&quot;&gt;
+    &lt;Marker name=&quot;Marker1&quot;&gt;
+        &lt;Parents&gt;
+            &lt;Parents name=&quot;ParentMarker1&quot;&gt;
+                &lt;Parents&gt;
+                    &lt;Parents name=&quot;GrandMotherMarker&quot;/&gt;
+                    &lt;Parents name=&quot;GrandFatherMarker&quot;/&gt;
+                &lt;/Parents&gt;
+            &lt;/Parents&gt;
+            &lt;Parents name=&quot;GrandFatherMarker&quot;/&gt;
+        &lt;/Parents&gt;
+    &lt;/Marker&gt;
+    &lt;Message&gt;Msg&lt;/Message&gt;
+    &lt;ContextMap&gt;
+        &lt;item key=&quot;MDC.B&quot; value=&quot;B_Value&quot;/&gt;
+        &lt;item key=&quot;MDC.A&quot; value=&quot;A_Value&quot;/&gt;
+    &lt;/ContextMap&gt;
+    &lt;ContextStack&gt;
+        &lt;ContextStack&gt;stack_msg1&lt;/ContextStack&gt;
+        &lt;ContextStack&gt;stack_msg2&lt;/ContextStack&gt;
+    &lt;/ContextStack&gt;
+    &lt;Source class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;54&quot;/&gt;
+    &lt;Thrown commonElementCount=&quot;0&quot; localizedMessage=&quot;testIOEx&quot; message=&quot;testIOEx&quot; name=&quot;java.io.IOException&quot;&gt;
+        &lt;Cause commonElementCount=&quot;27&quot; localizedMessage=&quot;testNPEx&quot; message=&quot;testNPEx&quot; name=&quot;java.lang.NullPointerException&quot;&gt;
+            &lt;ExtendedStackTrace&gt;
+                &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;53&quot; exact=&quot;false&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+            &lt;/ExtendedStackTrace&gt;
+        &lt;/Cause&gt;
+        &lt;ExtendedStackTrace&gt;
+            &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;56&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testAllFeatures&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;122&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testLocationOnCompactOnMdcOn&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;270&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;sun.reflect.DelegatingMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;java.lang.reflect.Method&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod$1&quot; method=&quot;runReflectiveCall&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;47&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.model.ReflectiveCallable&quot; method=&quot;run&quot; file=&quot;ReflectiveCallable.java&quot; line=&quot;12&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod&quot; method=&quot;invokeExplosively&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;44&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.InvokeMethod&quot; method=&quot;evaluate&quot; file=&quot;InvokeMethod.java&quot; line=&quot;17&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runLeaf&quot; file=&quot;ParentRunner.java&quot; line=&quot;271&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;70&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$3&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;238&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$1&quot; method=&quot;schedule&quot; file=&quot;ParentRunner.java&quot; line=&quot;63&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runChildren&quot; file=&quot;ParentRunner.java&quot; line=&quot;236&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;access$000&quot; file=&quot;ParentRunner.java&quot; line=&quot;53&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$2&quot; method=&quot;evaluate&quot; file=&quot;ParentRunner.java&quot; line=&quot;229&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunBefores&quot; method=&quot;evaluate&quot; file=&quot;RunBefores.java&quot; line=&quot;26&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunAfters&quot; method=&quot;evaluate&quot; file=&quot;RunAfters.java&quot; line=&quot;27&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;309&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference&quot; method=&quot;run&quot; file=&quot;JUnit4TestReference.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.TestExecution&quot; method=&quot;run&quot; file=&quot;TestExecution.java&quot; line=&quot;38&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;467&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;683&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;run&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;390&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;main&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;197&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+        &lt;/ExtendedStackTrace&gt;
+        &lt;Suppressed&gt;
+            &lt;Suppressed commonElementCount=&quot;0&quot; localizedMessage=&quot;I am suppressed exception 1&quot; message=&quot;I am suppressed exception 1&quot; name=&quot;java.lang.IndexOutOfBoundsException&quot;&gt;
+                &lt;ExtendedStackTrace&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;57&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testAllFeatures&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;122&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testLocationOnCompactOnMdcOn&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;270&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;sun.reflect.DelegatingMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;java.lang.reflect.Method&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod$1&quot; method=&quot;runReflectiveCall&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;47&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.model.ReflectiveCallable&quot; method=&quot;run&quot; file=&quot;ReflectiveCallable.java&quot; line=&quot;12&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod&quot; method=&quot;invokeExplosively&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;44&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.InvokeMethod&quot; method=&quot;evaluate&quot; file=&quot;InvokeMethod.java&quot; line=&quot;17&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runLeaf&quot; file=&quot;ParentRunner.java&quot; line=&quot;271&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;70&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$3&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;238&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$1&quot; method=&quot;schedule&quot; file=&quot;ParentRunner.java&quot; line=&quot;63&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runChildren&quot; file=&quot;ParentRunner.java&quot; line=&quot;236&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;access$000&quot; file=&quot;ParentRunner.java&quot; line=&quot;53&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$2&quot; method=&quot;evaluate&quot; file=&quot;ParentRunner.java&quot; line=&quot;229&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunBefores&quot; method=&quot;evaluate&quot; file=&quot;RunBefores.java&quot; line=&quot;26&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunAfters&quot; method=&quot;evaluate&quot; file=&quot;RunAfters.java&quot; line=&quot;27&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;309&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference&quot; method=&quot;run&quot; file=&quot;JUnit4TestReference.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.TestExecution&quot; method=&quot;run&quot; file=&quot;TestExecution.java&quot; line=&quot;38&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;467&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;683&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;run&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;390&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;main&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;197&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                &lt;/ExtendedStackTrace&gt;
+            &lt;/Suppressed&gt;
+            &lt;Suppressed commonElementCount=&quot;0&quot; localizedMessage=&quot;I am suppressed exception 2&quot; message=&quot;I am suppressed exception 2&quot; name=&quot;java.lang.IndexOutOfBoundsException&quot;&gt;
+                &lt;ExtendedStackTrace&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;58&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testAllFeatures&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;122&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testLocationOnCompactOnMdcOn&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;270&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;sun.reflect.DelegatingMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;java.lang.reflect.Method&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod$1&quot; method=&quot;runReflectiveCall&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;47&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.model.ReflectiveCallable&quot; method=&quot;run&quot; file=&quot;ReflectiveCallable.java&quot; line=&quot;12&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod&quot; method=&quot;invokeExplosively&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;44&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.InvokeMethod&quot; method=&quot;evaluate&quot; file=&quot;InvokeMethod.java&quot; line=&quot;17&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runLeaf&quot; file=&quot;ParentRunner.java&quot; line=&quot;271&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;70&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$3&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;238&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$1&quot; method=&quot;schedule&quot; file=&quot;ParentRunner.java&quot; line=&quot;63&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runChildren&quot; file=&quot;ParentRunner.java&quot; line=&quot;236&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;access$000&quot; file=&quot;ParentRunner.java&quot; line=&quot;53&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$2&quot; method=&quot;evaluate&quot; file=&quot;ParentRunner.java&quot; line=&quot;229&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunBefores&quot; method=&quot;evaluate&quot; file=&quot;RunBefores.java&quot; line=&quot;26&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunAfters&quot; method=&quot;evaluate&quot; file=&quot;RunAfters.java&quot; line=&quot;27&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;309&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference&quot; method=&quot;run&quot; file=&quot;JUnit4TestReference.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.TestExecution&quot; method=&quot;run&quot; file=&quot;TestExecution.java&quot; line=&quot;38&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;467&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;683&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;run&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;390&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;main&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;197&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
+                &lt;/ExtendedStackTrace&gt;
+            &lt;/Suppressed&gt;
+        &lt;/Suppressed&gt;
+    &lt;/Thrown&gt;
+&lt;/Event&gt;
+</pre>
+ * <p>
+ * If {@code complete="false"}, the appender does not write the XML processing instruction and the root element.
+ * </p>
+ * <p>
+ * This approach enforces the independence of the XmlLayout and the appender where you embed it.
+ * </p>
+ * <h4>Encoding</h4>
+ * <p>
+ * Appenders using this layout should have their {@code charset} set to {@code UTF-8} or {@code UTF-16}, otherwise events containing non
+ * ASCII characters could result in corrupted log files.
+ * </p>
+ * <h4>Pretty vs. compact XML</h4>
+ * <p>
+ * By default, the XML layout is not compact (compact = not "pretty") with {@code compact="false"}, which means the appender uses
+ * end-of-line characters and indents lines to format the XML. If {@code compact="true"}, then no end-of-line or indentation is used.
+ * Message content may contain, of course, end-of-lines.
+ * </p>
+ */
+@Plugin(name = "XmlLayout", category = "Core", elementType = "layout", printObject = true)
+public final class XmlLayout extends AbstractJacksonLayout {
+
+    private static final String ROOT_TAG = "Events";
+
+    protected XmlLayout(final boolean locationInfo, final boolean properties, final boolean complete, boolean compact, final Charset charset) {
+        super(new JacksonFactory.XML().newWriter(locationInfo, properties, compact), charset, compact, complete);
+    }
+
+    /**
+     * Returns appropriate XML headers.
+     * <ol>
+     * <li>XML processing instruction</li>
+     * <li>XML root element</li>
+     * </ol>
+     * 
+     * @return a byte array containing the header.
+     */
+    @Override
+    public byte[] getHeader() {
+        if (!complete) {
+            return null;
+        }
+        final StringBuilder buf = new StringBuilder();
+        buf.append("<?xml version=\"1.0\" encoding=\"");
+        buf.append(this.getCharset().name());
+        buf.append("\"?>");
+        buf.append(this.eol);
+        // Make the log4j namespace the default namespace, no need to use more space with a namespace prefix.
+        buf.append('<');
+        buf.append(ROOT_TAG);
+        buf.append(" xmlns=\"" + XMLConstants.XML_NAMESPACE + "\">");
+        buf.append(this.eol);
+        return buf.toString().getBytes(this.getCharset());
+    }
+
+    /**
+     * Returns appropriate XML footer.
+     * 
+     * @return a byte array containing the footer, closing the XML root element.
+     */
+    @Override
+    public byte[] getFooter() {
+        if (!complete) {
+            return null;
+        }
+        return ("</" + ROOT_TAG + '>' + this.eol).getBytes(getCharset());
+    }
+
+    /**
+     * XmlLayout's content format is specified by:
+     * <p/>
+     * Key: "dtd" Value: "log4j-events.dtd"
+     * <p/>
+     * Key: "version" Value: "2.0"
+     * 
+     * @return Map of content format keys supporting XmlLayout
+     */
+    @Override
+    public Map<String, String> getContentFormat() {
+        final Map<String, String> result = new HashMap<String, String>();
+        // result.put("dtd", "log4j-events.dtd");
+        result.put("xsd", "log4j-events.xsd");
+        result.put("version", "2.0");
+        return result;
+    }
+
+    @Override
+    /**
+     * @return The content type.
+     */
+    public String getContentType() {
+        return "text/xml; charset=" + this.getCharset();
+    }
+
+    /**
+     * Creates an XML Layout.
+     * 
+     * @param locationInfoStr If "true", includes the location information in the generated XML.
+     * @param propertiesStr If "true", includes the thread context in the generated XML.
+     * @param completeStr If "true", includes the XML header and footer, defaults to "false".
+     * @param compactStr If "true", does not use end-of-lines and indentation, defaults to "false".
+     * @param charsetName The character set to use, if {@code null}, uses "UTF-8".
+     * @return An XML Layout.
+     */
+    @PluginFactory
+    public static XmlLayout createLayout(
+            // @formatter:off
+            @PluginAttribute("locationInfo") final String locationInfoStr,
+            @PluginAttribute("properties") final String propertiesStr, 
+            @PluginAttribute("complete") final String completeStr,
+            @PluginAttribute("compact") final String compactStr, 
+            @PluginAttribute("charset") final String charsetName)
+            // @formatter:on
+    {
+        final Charset charset = Charsets.getSupportedCharset(charsetName, Charsets.UTF_8);
+        final boolean info = Boolean.parseBoolean(locationInfoStr);
+        final boolean props = Boolean.parseBoolean(propertiesStr);
+        final boolean complete = Boolean.parseBoolean(completeStr);
+        final boolean compact = Boolean.parseBoolean(compactStr);
+        return new XmlLayout(info, props, complete, compact, charset);
+    }
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MimeMessageBuilder.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MimeMessageBuilder.java?rev=1596613&r1=1596612&r2=1596613&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MimeMessageBuilder.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MimeMessageBuilder.java Wed May 21 16:31:17 2014
@@ -26,7 +26,7 @@ import javax.mail.internet.MimeMessage;
 import org.apache.logging.log4j.core.util.Charsets;
 
 /**
- *  Helper class for SMTPManager.
+ *  Helper class for SmtpManager.
  */
 public class MimeMessageBuilder {
     private final MimeMessage message;

Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDnsAdvertiser.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDnsAdvertiser.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDnsAdvertiser.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java&r1=1596559&r2=1596613&rev=1596613&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDnsAdvertiser.java Wed May 21 16:31:17 2014
@@ -36,14 +36,14 @@ import org.apache.logging.log4j.status.S
  *
  */
 @Plugin(name = "multicastdns", category = "Core", elementType = "advertiser", printObject = false)
-public class MulticastDNSAdvertiser implements Advertiser {
+public class MulticastDnsAdvertiser implements Advertiser {
     protected static final Logger LOGGER = StatusLogger.getLogger();
     private static Object jmDNS = initializeJMDNS();
 
     private static Class<?> jmDNSClass;
     private static Class<?> serviceInfoClass;
 
-    public MulticastDNSAdvertiser()
+    public MulticastDnsAdvertiser()
     {
         //no arg constructor for reflection
     }

Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java&r1=1596559&r2=1596613&rev=1596613&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java Wed May 21 16:31:17 2014
@@ -50,7 +50,7 @@ import org.apache.logging.log4j.util.Str
 /**
  * Manager for sending SMTP events.
  */
-public class SMTPManager extends AbstractManager {
+public class SmtpManager extends AbstractManager {
     private static final SMTPManagerFactory FACTORY = new SMTPManagerFactory();
 
     private final Session session;
@@ -61,7 +61,7 @@ public class SMTPManager extends Abstrac
 
     private final FactoryData data;
 
-    protected SMTPManager(final String name, final Session session, final MimeMessage message,
+    protected SmtpManager(final String name, final Session session, final MimeMessage message,
                           final FactoryData data) {
         super(name);
         this.session = session;
@@ -74,7 +74,7 @@ public class SMTPManager extends Abstrac
         buffer.add(event);
     }
 
-    public static SMTPManager getSMTPManager(final String to, final String cc, final String bcc,
+    public static SmtpManager getSMTPManager(final String to, final String cc, final String bcc,
                                              final String from, final String replyTo,
                                              final String subject, String protocol, final String host,
                                              final int port, final String username, final String password,
@@ -288,7 +288,7 @@ public class SMTPManager extends Abstrac
                 .setRecipients(Message.RecipientType.TO, data.to).setRecipients(Message.RecipientType.CC, data.cc)
                 .setRecipients(Message.RecipientType.BCC, data.bcc).setSubject(data.subject).getMimeMessage();
         } catch (final MessagingException e) {
-            LOGGER.error("Could not set SMTPAppender message options.", e);
+            LOGGER.error("Could not set SmtpAppender message options.", e);
             message = null;
         }
     }
@@ -296,10 +296,10 @@ public class SMTPManager extends Abstrac
     /**
      * Factory to create the SMTP Manager.
      */
-    private static class SMTPManagerFactory implements ManagerFactory<SMTPManager, FactoryData> {
+    private static class SMTPManagerFactory implements ManagerFactory<SmtpManager, FactoryData> {
 
         @Override
-        public SMTPManager createManager(final String name, final FactoryData data) {
+        public SmtpManager createManager(final String name, final FactoryData data) {
             final String prefix = "mail." + data.protocol;
 
             final Properties properties = PropertiesUtil.getSystemProperties();
@@ -331,11 +331,11 @@ public class SMTPManager extends Abstrac
                     .setRecipients(Message.RecipientType.TO, data.to).setRecipients(Message.RecipientType.CC, data.cc)
                     .setRecipients(Message.RecipientType.BCC, data.bcc).setSubject(data.subject).getMimeMessage();
             } catch (final MessagingException e) {
-                LOGGER.error("Could not set SMTPAppender message options.", e);
+                LOGGER.error("Could not set SmtpAppender message options.", e);
                 message = null;
             }
 
-            return new SMTPManager(name, session, message, data);
+            return new SmtpManager(name, session, message, data);
         }
 
         private Authenticator buildAuthenticator(final String username, final String password) {

Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java&r1=1596559&r2=1596613&rev=1596613&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java Wed May 21 16:31:17 2014
@@ -37,7 +37,7 @@ import org.apache.logging.log4j.util.Str
 /**
  * Manager of TCP Socket connections.
  */
-public class TCPSocketManager extends AbstractSocketManager {
+public class TcpSocketManager extends AbstractSocketManager {
     /**
       The default reconnection delay (30000 milliseconds or 30 seconds).
      */
@@ -71,7 +71,7 @@ public class TCPSocketManager extends Ab
      * @param immediateFail
      * @param layout The Layout.
      */
-    public TCPSocketManager(final String name, final OutputStream os, final Socket sock, final InetAddress addr,
+    public TcpSocketManager(final String name, final OutputStream os, final Socket sock, final InetAddress addr,
                             final String host, final int port, final int delay, final boolean immediateFail,
                             final Layout<? extends Serializable> layout) {
         super(name, os, addr, host, port, layout);
@@ -88,13 +88,13 @@ public class TCPSocketManager extends Ab
     }
 
     /**
-     * Obtain a TCPSocketManager.
+     * Obtain a TcpSocketManager.
      * @param host The host to connect to.
      * @param port The port on the host.
      * @param delay The interval to pause between retries.
-     * @return A TCPSocketManager.
+     * @return A TcpSocketManager.
      */
-    public static TCPSocketManager getSocketManager(final String host, int port, int delay,
+    public static TcpSocketManager getSocketManager(final String host, int port, int delay,
                                                     final boolean immediateFail, final Layout<? extends Serializable> layout ) {
         if (Strings.isEmpty(host)) {
             throw new IllegalArgumentException("A host name is required");
@@ -105,7 +105,7 @@ public class TCPSocketManager extends Ab
         if (delay == 0) {
             delay = DEFAULT_RECONNECTION_DELAY;
         }
-        return (TCPSocketManager) getManager("TCP:" + host + ':' + port,
+        return (TcpSocketManager) getManager("TCP:" + host + ':' + port,
             new FactoryData(host, port, delay, immediateFail, layout), FACTORY);
     }
 
@@ -147,10 +147,10 @@ public class TCPSocketManager extends Ab
     }
 
     /**
-     * TCPSocketManager's content format is specified by:<p/>
+     * TcpSocketManager's content format is specified by:<p/>
      * Key: "protocol" Value: "tcp"<p/>
      * Key: "direction" Value: "out"
-     * @return Map of content format keys supporting TCPSocketManager
+     * @return Map of content format keys supporting TcpSocketManager
      */
     @Override
     public Map<String, String> getContentFormat()
@@ -250,11 +250,11 @@ public class TCPSocketManager extends Ab
     }
 
     /**
-     * Factory to create a TCPSocketManager.
+     * Factory to create a TcpSocketManager.
      */
-    protected static class TCPSocketManagerFactory implements ManagerFactory<TCPSocketManager, FactoryData> {
+    protected static class TCPSocketManagerFactory implements ManagerFactory<TcpSocketManager, FactoryData> {
         @Override
-        public TCPSocketManager createManager(final String name, final FactoryData data) {
+        public TcpSocketManager createManager(final String name, final FactoryData data) {
 
             InetAddress address;
             OutputStream os;
@@ -267,16 +267,16 @@ public class TCPSocketManager extends Ab
             try {
                 final Socket socket = new Socket(data.host, data.port);
                 os = socket.getOutputStream();
-                return new TCPSocketManager(name, os, socket, address, data.host, data.port, data.delay,
+                return new TcpSocketManager(name, os, socket, address, data.host, data.port, data.delay,
                     data.immediateFail, data.layout);
             } catch (final IOException ex) {
-                LOGGER.error("TCPSocketManager (" + name + ") " + ex);
+                LOGGER.error("TcpSocketManager (" + name + ") " + ex);
                 os = new ByteArrayOutputStream();
             }
             if (data.delay == 0) {
                 return null;
             }
-            return new TCPSocketManager(name, os, null, address, data.host, data.port, data.delay, data.immediateFail,
+            return new TcpSocketManager(name, os, null, address, data.host, data.port, data.delay, data.immediateFail,
                 data.layout);
         }
     }

Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TlsSocketManager.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TlsSocketManager.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TlsSocketManager.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java&r1=1596559&r2=1596613&rev=1596613&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TlsSocketManager.java Wed May 21 16:31:17 2014
@@ -30,16 +30,16 @@ import javax.net.ssl.SSLSocketFactory;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.appender.ManagerFactory;
-import org.apache.logging.log4j.core.net.ssl.SSLConfiguration;
+import org.apache.logging.log4j.core.net.ssl.SslConfiguration;
 import org.apache.logging.log4j.util.Strings;
 
 /**
  *
  */
-public class TLSSocketManager extends TCPSocketManager {
+public class TlsSocketManager extends TcpSocketManager {
     public static final int DEFAULT_PORT = 6514;
     private static final TLSSocketManagerFactory FACTORY = new TLSSocketManagerFactory();
-    private final SSLConfiguration sslConfig;
+    private final SslConfiguration sslConfig;
 
     /**
      *
@@ -54,21 +54,21 @@ public class TLSSocketManager extends TC
      * @param immediateFail
      * @param layout        The Layout.
      */
-    public TLSSocketManager(final String name, final OutputStream os, final Socket sock, final SSLConfiguration sslConfig, final InetAddress addr,
+    public TlsSocketManager(final String name, final OutputStream os, final Socket sock, final SslConfiguration sslConfig, final InetAddress addr,
                             final String host, final int port, final int delay, final boolean immediateFail, final Layout<? extends Serializable> layout) {
         super(name, os, sock, addr, host, port, delay, immediateFail, layout);
         this.sslConfig = sslConfig;
     }
 
     private static class TLSFactoryData {
-        protected SSLConfiguration sslConfig;
+        protected SslConfiguration sslConfig;
         private final String host;
         private final int port;
         private final int delay;
         private final boolean immediateFail;
         private final Layout<? extends Serializable> layout;
 
-        public TLSFactoryData(final SSLConfiguration sslConfig, final String host, final int port, final int delay, final boolean immediateFail,
+        public TLSFactoryData(final SslConfiguration sslConfig, final String host, final int port, final int delay, final boolean immediateFail,
                               final Layout<? extends Serializable> layout) {
             this.host = host;
             this.port = port;
@@ -79,7 +79,7 @@ public class TLSSocketManager extends TC
         }
     }
 
-    public static TLSSocketManager getSocketManager(final SSLConfiguration sslConfig, final String host, int port,
+    public static TlsSocketManager getSocketManager(final SslConfiguration sslConfig, final String host, int port,
                                                     int delay, final boolean immediateFail, final Layout<? extends Serializable> layout ) {
         if (Strings.isEmpty(host)) {
             throw new IllegalArgumentException("A host name is required");
@@ -90,7 +90,7 @@ public class TLSSocketManager extends TC
         if (delay == 0) {
             delay = DEFAULT_RECONNECTION_DELAY;
         }
-        return (TLSSocketManager) getManager("TLS:" + host + ':' + port,
+        return (TlsSocketManager) getManager("TLS:" + host + ':' + port,
                 new TLSFactoryData(sslConfig, host, port, delay, immediateFail, layout), FACTORY);
     }
 
@@ -100,7 +100,7 @@ public class TLSSocketManager extends TC
         return socketFactory.createSocket(host, port);
     }
 
-    private static SSLSocketFactory createSSLSocketFactory(final SSLConfiguration sslConf) {
+    private static SSLSocketFactory createSSLSocketFactory(final SslConfiguration sslConf) {
         SSLSocketFactory socketFactory;
 
         if (sslConf != null) {
@@ -113,7 +113,7 @@ public class TLSSocketManager extends TC
     }
 
 
-    private static class TLSSocketManagerFactory implements ManagerFactory<TLSSocketManager, TLSFactoryData> {
+    private static class TLSSocketManagerFactory implements ManagerFactory<TlsSocketManager, TLSFactoryData> {
 
         private class TLSSocketManagerFactoryException extends Exception {
 
@@ -121,7 +121,7 @@ public class TLSSocketManager extends TC
         }
 
         @Override
-        public TLSSocketManager createManager(final String name, final TLSFactoryData data) {
+        public TlsSocketManager createManager(final String name, final TLSFactoryData data) {
             InetAddress address = null;
             OutputStream os = null;
             Socket socket = null;
@@ -133,7 +133,7 @@ public class TLSSocketManager extends TC
                 checkDelay(data.delay, os);
             }
             catch (final IOException e) {
-                LOGGER.error("TLSSocketManager ({})", name, e);
+                LOGGER.error("TlsSocketManager ({})", name, e);
                 os = new ByteArrayOutputStream();
             }
             catch (final TLSSocketManagerFactoryException e) {
@@ -171,8 +171,8 @@ public class TLSSocketManager extends TC
             return socket;
         }
 
-        private TLSSocketManager createManager(final String name, final OutputStream os, final Socket socket, final SSLConfiguration sslConfig, final InetAddress address, final String host, final int port, final int delay, final boolean immediateFail, final Layout<? extends Serializable> layout) {
-            return new TLSSocketManager(name, os, socket, sslConfig, address, host, port, delay, immediateFail, layout);
+        private TlsSocketManager createManager(final String name, final OutputStream os, final Socket socket, final SslConfiguration sslConfig, final InetAddress address, final String host, final int port, final int delay, final boolean immediateFail, final Layout<? extends Serializable> layout) {
+            return new TlsSocketManager(name, os, socket, sslConfig, address, host, port, delay, immediateFail, layout);
         }
     }
 }

Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsManager.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSManager.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsManager.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsManager.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSManager.java&r1=1596559&r2=1596613&rev=1596613&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSManager.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsManager.java Wed May 21 16:31:17 2014
@@ -35,13 +35,13 @@ import org.apache.logging.log4j.core.app
 /**
  * Base Class for Managers of JMS connections.
  */
-public abstract class AbstractJMSManager extends AbstractManager {
+public abstract class AbstractJmsManager extends AbstractManager {
 
     /**
      * The Constructor.
      * @param name The name of the Appender.
      */
-    public AbstractJMSManager(final String name) {
+    public AbstractJmsManager(final String name) {
         super(name);
     }
 

Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsReceiver.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSReceiver.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsReceiver.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsReceiver.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSReceiver.java&r1=1596559&r2=1596613&rev=1596613&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSReceiver.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsReceiver.java Wed May 21 16:31:17 2014
@@ -32,7 +32,7 @@ import org.apache.logging.log4j.core.Log
 /**
  * Abstract base class for receiving LogEvents over JMS. This class expects all messages to be serialized log events.
  */
-public abstract class AbstractJMSReceiver extends LogEventListener implements javax.jms.MessageListener {
+public abstract class AbstractJmsReceiver extends LogEventListener implements javax.jms.MessageListener {
 
     /**
      * Logger to capture diagnostics.



Re: svn commit: r1596613 [2/5] - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/appender/ log4j-core/src/main/java/org/apache/logging/log4j/core/appender/jms/ log4j-core/src/main/java/org/apache/logging/log4j/core/ap...

Posted by Ralph Goers <ra...@dslextreme.com>.
Hmm. I hadn’t thought about this one.  Do we want the camel case rules to apply to plugin names as well?  I guess it doesn’t really matter since they are case insensitive.

Ralph


On May 21, 2014, at 9:31 AM, ggregory@apache.org wrote:

> Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java?rev=1596613&view=auto
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java (added)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java Wed May 21 16:31:17 2014
> @@ -0,0 +1,722 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements. See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache license, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + *
> + *      http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the license for the specific language governing permissions and
> + * limitations under the license.
> + */
> +package org.apache.logging.log4j.core.layout;
> +
> +import java.nio.charset.Charset;
> +import java.util.ArrayList;
> +import java.util.Calendar;
> +import java.util.GregorianCalendar;
> +import java.util.HashMap;
> +import java.util.List;
> +import java.util.Map;
> +import java.util.SortedMap;
> +import java.util.TreeMap;
> +import java.util.regex.Matcher;
> +import java.util.regex.Pattern;
> +
> +import org.apache.logging.log4j.Level;
> +import org.apache.logging.log4j.LoggingException;
> +import org.apache.logging.log4j.core.LogEvent;
> +import org.apache.logging.log4j.core.appender.TlsSyslogFrame;
> +import org.apache.logging.log4j.core.config.Configuration;
> +import org.apache.logging.log4j.core.config.plugins.Plugin;
> +import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
> +import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
> +import org.apache.logging.log4j.core.config.plugins.PluginElement;
> +import org.apache.logging.log4j.core.config.plugins.PluginFactory;
> +import org.apache.logging.log4j.core.net.Facility;
> +import org.apache.logging.log4j.core.net.Priority;
> +import org.apache.logging.log4j.core.pattern.LogEventPatternConverter;
> +import org.apache.logging.log4j.core.pattern.PatternConverter;
> +import org.apache.logging.log4j.core.pattern.PatternFormatter;
> +import org.apache.logging.log4j.core.pattern.PatternParser;
> +import org.apache.logging.log4j.core.pattern.ThrowablePatternConverter;
> +import org.apache.logging.log4j.core.util.Booleans;
> +import org.apache.logging.log4j.core.util.Charsets;
> +import org.apache.logging.log4j.core.util.Integers;
> +import org.apache.logging.log4j.core.util.NetUtils;
> +import org.apache.logging.log4j.core.util.Patterns;
> +import org.apache.logging.log4j.message.Message;
> +import org.apache.logging.log4j.message.StructuredDataId;
> +import org.apache.logging.log4j.message.StructuredDataMessage;
> +import org.apache.logging.log4j.util.Strings;
> +
> +
> +/**
> + * Formats a log event in accordance with RFC 5424.
> + *
> + * @see <a href="https://tools.ietf.org/html/rfc5424">RFC 5424</a>
> + */
> +@Plugin(name = "Rfc5424Layout", category = "Core", elementType = "layout", printObject = true)
> +public final class Rfc5424Layout extends AbstractStringLayout {
> +
> +    private static final String LF = "\n";
> +
> +    /**
> +     * Not a very good default - it is the Apache Software Foundation's enterprise number.
> +     */
> +    public static final int DEFAULT_ENTERPRISE_NUMBER = 18060;
> +    /**
> +     * The default event id.
> +     */
> +    public static final String DEFAULT_ID = "Audit";
> +    /**
> +     * Match newlines in a platform-independent manner.
> +     */
> +    public static final Pattern NEWLINE_PATTERN = Pattern.compile("\\r?\\n");
> +    /**
> +     * Match characters which require escaping
> +     */
> +    public static final Pattern PARAM_VALUE_ESCAPE_PATTERN = Pattern.compile("[\\\"\\]\\\\]");
> +
> +    protected static final String DEFAULT_MDCID = "mdc";
> +    private static final int TWO_DIGITS = 10;
> +    private static final int THREE_DIGITS = 100;
> +    private static final int MILLIS_PER_MINUTE = 60000;
> +    private static final int MINUTES_PER_HOUR = 60;
> +
> +    private static final String COMPONENT_KEY = "RFC5424-Converter";
> +
> +    private final Facility facility;
> +    private final String defaultId;
> +    private final int enterpriseNumber;
> +    private final boolean includeMDC;
> +    private final String mdcId;
> +    private final StructuredDataId mdcSDID;
> +    private final String localHostName;
> +    private final String appName;
> +    private final String messageId;
> +    private final String configName;
> +    private final String mdcPrefix;
> +    private final String eventPrefix;
> +    private final List<String> mdcExcludes;
> +    private final List<String> mdcIncludes;
> +    private final List<String> mdcRequired;
> +    private final ListChecker checker;
> +    private final ListChecker noopChecker = new NoopChecker();
> +    private final boolean includeNewLine;
> +    private final String escapeNewLine;
> +    private final boolean useTLSMessageFormat;
> +
> +    private long lastTimestamp = -1;
> +    private String timestamppStr;
> +
> +    private final List<PatternFormatter> exceptionFormatters;
> +    private final Map<String,  FieldFormatter> fieldFormatters;
> +
> +    private Rfc5424Layout(final Configuration config, final Facility facility, final String id, final int ein,
> +                          final boolean includeMDC, final boolean includeNL, final String escapeNL, final String mdcId,
> +                          final String mdcPrefix, final String eventPrefix,
> +                          final String appName, final String messageId, final String excludes, final String includes,
> +                          final String required, final Charset charset, final String exceptionPattern,
> +                          final boolean useTLSMessageFormat, final LoggerFields[] loggerFields) {
> +        super(charset);
> +        final PatternParser exceptionParser = createPatternParser(config, ThrowablePatternConverter.class);
> +        exceptionFormatters = exceptionPattern == null ? null : exceptionParser.parse(exceptionPattern, false, false);
> +        this.facility = facility;
> +        this.defaultId = id == null ? DEFAULT_ID : id;
> +        this.enterpriseNumber = ein;
> +        this.includeMDC = includeMDC;
> +        this.includeNewLine = includeNL;
> +        this.escapeNewLine = escapeNL == null ? null : Matcher.quoteReplacement(escapeNL);
> +        this.mdcId = mdcId;
> +        this.mdcSDID = new StructuredDataId(mdcId, enterpriseNumber, null, null);
> +        this.mdcPrefix = mdcPrefix;
> +        this.eventPrefix = eventPrefix;
> +        this.appName = appName;
> +        this.messageId = messageId;
> +        this.useTLSMessageFormat = useTLSMessageFormat;
> +        this.localHostName = NetUtils.getLocalHostname();
> +        ListChecker c = null;
> +        if (excludes != null) {
> +            final String[] array = excludes.split(Patterns.COMMA_SEPARATOR);
> +            if (array.length > 0) {
> +                c = new ExcludeChecker();
> +                mdcExcludes = new ArrayList<String>(array.length);
> +                for (final String str : array) {
> +                    mdcExcludes.add(str.trim());
> +                }
> +            } else {
> +                mdcExcludes = null;
> +            }
> +        } else {
> +            mdcExcludes = null;
> +        }
> +        if (includes != null) {
> +            final String[] array = includes.split(Patterns.COMMA_SEPARATOR);
> +            if (array.length > 0) {
> +                c = new IncludeChecker();
> +                mdcIncludes = new ArrayList<String>(array.length);
> +                for (final String str : array) {
> +                    mdcIncludes.add(str.trim());
> +                }
> +            } else {
> +                mdcIncludes = null;
> +            }
> +        } else {
> +            mdcIncludes = null;
> +        }
> +        if (required != null) {
> +            final String[] array = required.split(Patterns.COMMA_SEPARATOR);
> +            if (array.length > 0) {
> +                mdcRequired = new ArrayList<String>(array.length);
> +                for (final String str : array) {
> +                    mdcRequired.add(str.trim());
> +                }
> +            } else {
> +                mdcRequired = null;
> +            }
> +
> +        } else {
> +            mdcRequired = null;
> +        }
> +        this.checker = c != null ? c : noopChecker;
> +        final String name = config == null ? null : config.getName();
> +        configName = name != null && name.length() > 0 ? name : null;
> +        this.fieldFormatters = createFieldFormatters(loggerFields, config);
> +    }
> +
> +    private Map<String, FieldFormatter> createFieldFormatters(final LoggerFields[] loggerFields,
> +            final Configuration config) {
> +        final Map<String, FieldFormatter> sdIdMap = new HashMap<String, FieldFormatter>();
> +
> +        if (loggerFields != null) {
> +            for (final LoggerFields lField : loggerFields) {
> +                final StructuredDataId key = lField.getSdId() == null ? mdcSDID : lField.getSdId();
> +                final Map<String, List<PatternFormatter>> sdParams = new HashMap<String, List<PatternFormatter>>();
> +                final Map<String, String> fields = lField.getMap();
> +                if (!fields.isEmpty()) {
> +                    final PatternParser fieldParser = createPatternParser(config, null);
> +
> +                    for (final Map.Entry<String, String> entry : fields.entrySet()) {
> +                        final List<PatternFormatter> formatters = fieldParser.parse(entry.getValue(), false, false);
> +                        sdParams.put(entry.getKey(), formatters);
> +                    }
> +                    final FieldFormatter fieldFormatter = new FieldFormatter(sdParams,
> +                            lField.getDiscardIfAllFieldsAreEmpty());
> +                    sdIdMap.put(key.toString(), fieldFormatter);
> +                }
> +            }
> +        }
> +        return sdIdMap.size() > 0 ? sdIdMap : null;
> +    }
> +
> +    /**
> +     * Create a PatternParser.
> +     *
> +     * @param config The Configuration.
> +     * @param filterClass Filter the returned plugins after calling the plugin manager.
> +     * @return The PatternParser.
> +     */
> +    private static PatternParser createPatternParser(final Configuration config,
> +            final Class<? extends PatternConverter> filterClass) {
> +        if (config == null) {
> +            return new PatternParser(config, PatternLayout.KEY, LogEventPatternConverter.class, filterClass);
> +        }
> +        PatternParser parser = config.getComponent(COMPONENT_KEY);
> +        if (parser == null) {
> +            parser = new PatternParser(config, PatternLayout.KEY, ThrowablePatternConverter.class);
> +            config.addComponent(COMPONENT_KEY, parser);
> +            parser = (PatternParser) config.getComponent(COMPONENT_KEY);
> +        }
> +        return parser;
> +    }
> +
> +    /**
> +     * Rfc5424Layout's content format is specified by:<p/>
> +     * Key: "structured" Value: "true"<p/>
> +     * Key: "format" Value: "RFC5424"<p/>
> +     *
> +     * @return Map of content format keys supporting Rfc5424Layout
> +     */
> +    @Override
> +    public Map<String, String> getContentFormat() {
> +        final Map<String, String> result = new HashMap<String, String>();
> +        result.put("structured", "true");
> +        result.put("formatType", "RFC5424");
> +        return result;
> +    }
> +
> +    /**
> +     * Formats a {@link org.apache.logging.log4j.core.LogEvent} in conformance with the RFC 5424 Syslog specification.
> +     *
> +     * @param event The LogEvent.
> +     * @return The RFC 5424 String representation of the LogEvent.
> +     */
> +    @Override
> +    public String toSerializable(final LogEvent event) {
> +        final StringBuilder buf = new StringBuilder();
> +        appendPriority(buf, event.getLevel());
> +        appendTimestamp(buf, event.getTimeMillis());
> +        appendSpace(buf);
> +        appendHostName(buf);
> +        appendSpace(buf);
> +        appendAppName(buf);
> +        appendSpace(buf);
> +        appendProcessId(buf);
> +        appendSpace(buf);
> +        appendMessageId(buf, event.getMessage());
> +        appendSpace(buf);
> +        appendStructuredElements(buf, event);
> +        appendMessage(buf, event);
> +        if (useTLSMessageFormat) {
> +            return new TlsSyslogFrame(buf.toString()).toString();
> +        }
> +        return buf.toString();
> +    }
> +
> +    private void appendPriority(final StringBuilder buffer, final Level logLevel) {
> +        buffer.append('<');
> +        buffer.append(Priority.getPriority(facility, logLevel));
> +        buffer.append(">1 ");
> +    }
> +
> +    private void appendTimestamp(final StringBuilder buffer, final long milliseconds)  {
> +        buffer.append(computeTimeStampString(milliseconds));
> +    }
> +
> +    private void appendSpace(final StringBuilder buffer) {
> +        buffer.append(' ');
> +    }
> +
> +    private void appendHostName(final StringBuilder buffer) {
> +        buffer.append(localHostName);
> +    }
> +
> +    private void appendAppName(final StringBuilder buffer) {
> +        if (appName != null) {
> +            buffer.append(appName);
> +        } else if (configName != null) {
> +            buffer.append(configName);
> +        } else {
> +            buffer.append('-');
> +        }
> +    }
> +
> +    private void appendProcessId(final StringBuilder buffer) {
> +        buffer.append(getProcId());
> +    }
> +
> +    private void appendMessageId(final StringBuilder buffer, final Message message) {
> +        final boolean isStructured = message instanceof StructuredDataMessage;
> +        final String type = isStructured ? ((StructuredDataMessage) message).getType() : null;
> +        if (type != null) {
> +            buffer.append(type);
> +        } else if (messageId != null) {
> +            buffer.append(messageId);
> +        } else {
> +            buffer.append('-');
> +        }
> +    }
> +
> +    private void appendMessage(final StringBuilder buffer, final LogEvent event) {
> +        final Message message = event.getMessage();
> +        // This layout formats StructuredDataMessages instead of delegating to the Message itself.
> +        final String text = (message instanceof StructuredDataMessage) ? message.getFormat() : message.getFormattedMessage();
> +
> +        if (text != null && text.length() > 0) {
> +            buffer.append(' ').append(escapeNewlines(text, escapeNewLine));
> +        }
> +
> +        if (exceptionFormatters != null && event.getThrown() != null) {
> +            final StringBuilder exception = new StringBuilder(LF);
> +            for (final PatternFormatter formatter : exceptionFormatters) {
> +                formatter.format(event, exception);
> +            }
> +            buffer.append(escapeNewlines(exception.toString(), escapeNewLine));
> +        }
> +        if (includeNewLine) {
> +            buffer.append(LF);
> +        }
> +    }
> +
> +    private void appendStructuredElements(final StringBuilder buffer, final LogEvent event) {
> +        final Message message = event.getMessage();
> +        final boolean isStructured = message instanceof StructuredDataMessage;
> +
> +        if (!isStructured && (fieldFormatters!= null && fieldFormatters.size() == 0) && !includeMDC) {
> +            buffer.append('-');
> +            return;
> +        }
> +
> +        final Map<String, StructuredDataElement> sdElements = new HashMap<String, StructuredDataElement>();
> +        final Map<String, String> contextMap = event.getContextMap();
> +
> +        if (mdcRequired != null) {
> +            checkRequired(contextMap);
> +        }
> +
> +        if (fieldFormatters != null) {
> +            for (final Map.Entry<String, FieldFormatter> sdElement: fieldFormatters.entrySet()) {
> +                final String sdId = sdElement.getKey();
> +                final StructuredDataElement elem = sdElement.getValue().format(event);
> +                sdElements.put(sdId, elem);
> +            }
> +        }
> +
> +        if (includeMDC && contextMap.size() > 0) {
> +            if (sdElements.containsKey(mdcSDID.toString())) {
> +                final StructuredDataElement union = sdElements.get(mdcSDID.toString());
> +                union.union(contextMap);
> +                sdElements.put(mdcSDID.toString(), union);
> +            } else {
> +                final StructuredDataElement formattedContextMap = new StructuredDataElement(contextMap, false);
> +                sdElements.put(mdcSDID.toString(), formattedContextMap);
> +            }
> +        }
> +
> +        if (isStructured) {
> +            final StructuredDataMessage data = (StructuredDataMessage) message;
> +            final Map<String, String> map = data.getData();
> +            final StructuredDataId id = data.getId();
> +            final String sdId = getId(id);
> +
> +            if (sdElements.containsKey(sdId)) {
> +                final StructuredDataElement union = sdElements.get(id.toString());
> +                union.union(map);
> +                sdElements.put(sdId, union);
> +            } else {
> +                final StructuredDataElement formattedData = new StructuredDataElement(map, false);
> +                sdElements.put(sdId, formattedData);
> +            }
> +        }
> +
> +        if (sdElements.size() == 0) {
> +            buffer.append('-');
> +            return;
> +        }
> +
> +        for (final Map.Entry<String, StructuredDataElement> entry: sdElements.entrySet()) {
> +            formatStructuredElement(entry.getKey(), mdcPrefix, entry.getValue(), buffer, checker);
> +        }
> +    }
> +
> +    private String escapeNewlines(final String text, final String escapeNewLine) {
> +        if (null == escapeNewLine) {
> +            return text;
> +        }
> +        return NEWLINE_PATTERN.matcher(text).replaceAll(escapeNewLine);
> +    }
> +
> +    protected String getProcId() {
> +        return "-";
> +    }
> +
> +    protected List<String> getMdcExcludes() {
> +        return mdcExcludes;
> +    }
> +
> +    protected List<String> getMdcIncludes() {
> +        return mdcIncludes;
> +    }
> +
> +    private String computeTimeStampString(final long now) {
> +        long last;
> +        synchronized (this) {
> +            last = lastTimestamp;
> +            if (now == lastTimestamp) {
> +                return timestamppStr;
> +            }
> +        }
> +
> +        final StringBuilder buffer = new StringBuilder();
> +        final Calendar cal = new GregorianCalendar();
> +        cal.setTimeInMillis(now);
> +        buffer.append(Integer.toString(cal.get(Calendar.YEAR)));
> +        buffer.append('-');
> +        pad(cal.get(Calendar.MONTH) + 1, TWO_DIGITS, buffer);
> +        buffer.append('-');
> +        pad(cal.get(Calendar.DAY_OF_MONTH), TWO_DIGITS, buffer);
> +        buffer.append('T');
> +        pad(cal.get(Calendar.HOUR_OF_DAY), TWO_DIGITS, buffer);
> +        buffer.append(':');
> +        pad(cal.get(Calendar.MINUTE), TWO_DIGITS, buffer);
> +        buffer.append(':');
> +        pad(cal.get(Calendar.SECOND), TWO_DIGITS, buffer);
> +
> +        final int millis = cal.get(Calendar.MILLISECOND);
> +        if (millis != 0) {
> +            buffer.append('.');
> +            pad(millis, THREE_DIGITS, buffer);
> +        }
> +
> +        int tzmin = (cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)) / MILLIS_PER_MINUTE;
> +        if (tzmin == 0) {
> +            buffer.append('Z');
> +        } else {
> +            if (tzmin < 0) {
> +                tzmin = -tzmin;
> +                buffer.append('-');
> +            } else {
> +                buffer.append('+');
> +            }
> +            final int tzhour = tzmin / MINUTES_PER_HOUR;
> +            tzmin -= tzhour * MINUTES_PER_HOUR;
> +            pad(tzhour, TWO_DIGITS, buffer);
> +            buffer.append(':');
> +            pad(tzmin, TWO_DIGITS, buffer);
> +        }
> +        synchronized (this) {
> +            if (last == lastTimestamp) {
> +                lastTimestamp = now;
> +                timestamppStr = buffer.toString();
> +            }
> +        }
> +        return buffer.toString();
> +    }
> +
> +    private void pad(final int val, int max, final StringBuilder buf) {
> +        while (max > 1) {
> +            if (val < max) {
> +                buf.append('0');
> +            }
> +            max = max / TWO_DIGITS;
> +        }
> +        buf.append(Integer.toString(val));
> +    }
> +
> +    private void formatStructuredElement(final String id, final String prefix, final StructuredDataElement data,
> +                                         final StringBuilder sb, final ListChecker checker) {
> +        if ((id == null && defaultId == null) || data.discard()) {
> +            return;
> +        }
> +
> +        sb.append('[');
> +        sb.append(id);
> +        if (!mdcSDID.toString().equals(id)) {
> +            appendMap(prefix, data.getFields(), sb, noopChecker);
> +        } else {
> +            appendMap(prefix, data.getFields(), sb, checker);
> +        }
> +        sb.append(']');
> +    }
> +
> +    private String getId(final StructuredDataId id) {
> +        final StringBuilder sb = new StringBuilder();
> +        if (id == null || id.getName() == null) {
> +            sb.append(defaultId);
> +        } else {
> +            sb.append(id.getName());
> +        }
> +        int ein = id != null ? id.getEnterpriseNumber() : enterpriseNumber;
> +        if (ein < 0) {
> +            ein = enterpriseNumber;
> +        }
> +        if (ein >= 0) {
> +            sb.append('@').append(ein);
> +        }
> +        return sb.toString();
> +    }
> +
> +    private void checkRequired(final Map<String, String> map) {
> +        for (final String key : mdcRequired) {
> +            final String value = map.get(key);
> +            if (value == null) {
> +                throw new LoggingException("Required key " + key + " is missing from the " + mdcId);
> +            }
> +        }
> +    }
> +
> +    private void appendMap(final String prefix, final Map<String, String> map, final StringBuilder sb,
> +                           final ListChecker checker) {
> +        final SortedMap<String, String> sorted = new TreeMap<String, String>(map);
> +        for (final Map.Entry<String, String> entry : sorted.entrySet()) {
> +            if (checker.check(entry.getKey()) && entry.getValue() != null) {
> +                sb.append(' ');
> +                if (prefix != null) {
> +                    sb.append(prefix);
> +                }
> +                sb.append(escapeNewlines(escapeSDParams(entry.getKey()), escapeNewLine)).append("=\"")
> +                    .append(escapeNewlines(escapeSDParams(entry.getValue()), escapeNewLine)).append('"');
> +            }
> +        }
> +    }
> +
> +    private String escapeSDParams(final String value) {
> +        return PARAM_VALUE_ESCAPE_PATTERN.matcher(value).replaceAll("\\\\$0");
> +    }
> +
> +    /**
> +     * Interface used to check keys in a Map.
> +     */
> +    private interface ListChecker {
> +        boolean check(String key);
> +    }
> +
> +    /**
> +     * Includes only the listed keys.
> +     */
> +    private class IncludeChecker implements ListChecker {
> +        @Override
> +        public boolean check(final String key) {
> +            return mdcIncludes.contains(key);
> +        }
> +    }
> +
> +    /**
> +     * Excludes the listed keys.
> +     */
> +    private class ExcludeChecker implements ListChecker {
> +        @Override
> +        public boolean check(final String key) {
> +            return !mdcExcludes.contains(key);
> +        }
> +    }
> +
> +    /**
> +     * Does nothing.
> +     */
> +    private class NoopChecker implements ListChecker {
> +        @Override
> +        public boolean check(final String key) {
> +            return true;
> +        }
> +    }
> +
> +    @Override
> +    public String toString() {
> +        final StringBuilder sb = new StringBuilder();
> +        sb.append("facility=").append(facility.name());
> +        sb.append(" appName=").append(appName);
> +        sb.append(" defaultId=").append(defaultId);
> +        sb.append(" enterpriseNumber=").append(enterpriseNumber);
> +        sb.append(" newLine=").append(includeNewLine);
> +        sb.append(" includeMDC=").append(includeMDC);
> +        sb.append(" messageId=").append(messageId);
> +        return sb.toString();
> +    }
> +
> +    /**
> +     * Create the RFC 5424 Layout.
> +     *
> +     * @param facility         The Facility is used to try to classify the message.
> +     * @param id               The default structured data id to use when formatting according to RFC 5424.
> +     * @param ein              The IANA enterprise number.
> +     * @param includeMDC       Indicates whether data from the ThreadContextMap will be included in the RFC 5424 Syslog
> +     *                         record. Defaults to "true:.
> +     * @param mdcId            The id to use for the MDC Structured Data Element.
> +     * @param mdcPrefix        The prefix to add to MDC key names.
> +     * @param eventPrefix      The prefix to add to event key names.
> +     * @param includeNL        If true, a newline will be appended to the end of the syslog record. The default is false.
> +     * @param escapeNL         String that should be used to replace newlines within the message text.
> +     * @param appName          The value to use as the APP-NAME in the RFC 5424 syslog record.
> +     * @param msgId            The default value to be used in the MSGID field of RFC 5424 syslog records.
> +     * @param excludes         A comma separated list of MDC keys that should be excluded from the LogEvent.
> +     * @param includes         A comma separated list of MDC keys that should be included in the FlumeEvent.
> +     * @param required         A comma separated list of MDC keys that must be present in the MDC.
> +     * @param exceptionPattern The pattern for formatting exceptions.
> +     * @param useTLSMessageFormat If true the message will be formatted according to RFC 5425.
> +     * @param loggerFields     Container for the KeyValuePairs containing the patterns
> +     * @param config           The Configuration. Some Converters require access to the Interpolator.
> +     * @return An Rfc5424Layout.
> +     */
> +    @PluginFactory
> +    public static Rfc5424Layout createLayout(
> +            @PluginAttribute("facility") final String facility,
> +            @PluginAttribute("id") final String id,
> +            @PluginAttribute("enterpriseNumber") final String ein,
> +            @PluginAttribute("includeMDC") final String includeMDC,
> +            @PluginAttribute("mdcId") String mdcId,
> +            @PluginAttribute("mdcPrefix") final String mdcPrefix,
> +            @PluginAttribute("eventPrefix") final String eventPrefix,
> +            @PluginAttribute("newLine") final String includeNL,
> +            @PluginAttribute("newLineEscape") final String escapeNL,
> +            @PluginAttribute("appName") final String appName,
> +            @PluginAttribute("messageId") final String msgId,
> +            @PluginAttribute("mdcExcludes") final String excludes,
> +            @PluginAttribute("mdcIncludes") String includes,
> +            @PluginAttribute("mdcRequired") final String required,
> +            @PluginAttribute("exceptionPattern") final String exceptionPattern,
> +            @PluginAttribute("useTLSMessageFormat") final String useTLSMessageFormat, // RFC 5425
> +            @PluginElement("LoggerFields") final LoggerFields[] loggerFields,
> +            @PluginConfiguration final Configuration config) {
> +        final Charset charset = Charsets.UTF_8;
> +        if (includes != null && excludes != null) {
> +            LOGGER.error("mdcIncludes and mdcExcludes are mutually exclusive. Includes wil be ignored");
> +            includes = null;
> +        }
> +        final Facility f = Facility.toFacility(facility, Facility.LOCAL0);
> +        final int enterpriseNumber = Integers.parseInt(ein, DEFAULT_ENTERPRISE_NUMBER);
> +        final boolean isMdc = Booleans.parseBoolean(includeMDC, true);
> +        final boolean includeNewLine = Boolean.parseBoolean(includeNL);
> +        final boolean useTlsMessageFormat = Booleans.parseBoolean(useTLSMessageFormat, false);
> +        if (mdcId == null) {
> +            mdcId = DEFAULT_MDCID;
> +        }
> +
> +        return new Rfc5424Layout(config, f, id, enterpriseNumber, isMdc, includeNewLine, escapeNL, mdcId, mdcPrefix,
> +                eventPrefix, appName, msgId, excludes, includes, required, charset, exceptionPattern,
> +                useTlsMessageFormat, loggerFields);
> +    }
> +
> +    private class FieldFormatter {
> +
> +        private final Map<String, List<PatternFormatter>> delegateMap;
> +        private final boolean discardIfEmpty;
> +
> +        public FieldFormatter(final Map<String, List<PatternFormatter>> fieldMap, final boolean discardIfEmpty) {
> +            this.discardIfEmpty = discardIfEmpty;
> +            this.delegateMap = fieldMap;
> +        }
> +
> +        public StructuredDataElement format(final LogEvent event) {
> +            final Map<String, String> map = new HashMap<String, String>();
> +
> +            for (final Map.Entry<String, List<PatternFormatter>> entry : delegateMap.entrySet()) {
> +                final StringBuilder buffer = new StringBuilder();
> +                for (final PatternFormatter formatter : entry.getValue()) {
> +                    formatter.format(event, buffer);
> +                }
> +                map.put(entry.getKey(), buffer.toString());
> +            }
> +            return new StructuredDataElement(map, discardIfEmpty);
> +        }
> +    }
> +
> +    private class StructuredDataElement {
> +
> +        private final Map<String, String> fields;
> +        private final boolean discardIfEmpty;
> +
> +        public StructuredDataElement(final Map<String, String> fields, final boolean discardIfEmpty) {
> +            this.discardIfEmpty = discardIfEmpty;
> +            this.fields = fields;
> +        }
> +
> +        boolean discard() {
> +            if (discardIfEmpty == false) {
> +                return false;
> +            }
> +            boolean foundNotEmptyValue = false;
> +            for (final Map.Entry<String, String> entry : fields.entrySet()) {
> +                if (Strings.isNotEmpty(entry.getValue())) {
> +                    foundNotEmptyValue = true;
> +                    break;
> +                }
> +            }
> +            return !foundNotEmptyValue;
> +        }
> +
> +        void union(final Map<String, String> fields) {
> +            this.fields.putAll(fields);
> +        }
> +
> +        Map<String, String> getFields() {
> +            return this.fields;
> +        }
> +    }
> +}
> 
> Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
> 
> Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
> ------------------------------------------------------------------------------
>    svn:keywords = Id
> 
> Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java?rev=1596613&view=auto
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java (added)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java Wed May 21 16:31:17 2014
> @@ -0,0 +1,289 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements. See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache license, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + *
> + *      http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the license for the specific language governing permissions and
> + * limitations under the license.
> + */
> +package org.apache.logging.log4j.core.layout;
> +
> +import java.nio.charset.Charset;
> +import java.util.HashMap;
> +import java.util.Map;
> +
> +import org.apache.logging.log4j.core.config.plugins.Plugin;
> +import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
> +import org.apache.logging.log4j.core.config.plugins.PluginFactory;
> +import org.apache.logging.log4j.core.jackson.XMLConstants;
> +import org.apache.logging.log4j.core.util.Charsets;
> +
> +/**
> + * Appends a series of {@code event} elements as defined in the <a href="log4j.dtd">log4j.dtd</a>.
> + * 
> + * <h4>Complete well-formed XML vs. fragment XML</h4>
> + * <p>
> + * If you configure {@code complete="true"}, the appender outputs a well-formed XML document where the default namespace is the log4j
> + * namespace {@value XMLConstants#XML_NAMESPACE}. By default, with {@code complete="false"}, you should include the output as an
> + * <em>external entity</em> in a separate file to form a well-formed XML document.
> + * </p>
> + * <p>
> + * A well-formed XML document follows this pattern:
> + * </p>
> + * <pre>
> +&lt;Event xmlns=&quot;http://logging.apache.org/log4j/2.0/events&quot; timeMillis=&quot;1&quot; thread=&quot;MyThreadName&quot; level=&quot;DEBUG&quot; loggerName=&quot;a.B&quot; loggerFQCN=&quot;f.q.c.n&quot; endOfBatch=&quot;false&quot;&gt;
> +    &lt;Marker name=&quot;Marker1&quot;&gt;
> +        &lt;Parents&gt;
> +            &lt;Parents name=&quot;ParentMarker1&quot;&gt;
> +                &lt;Parents&gt;
> +                    &lt;Parents name=&quot;GrandMotherMarker&quot;/&gt;
> +                    &lt;Parents name=&quot;GrandFatherMarker&quot;/&gt;
> +                &lt;/Parents&gt;
> +            &lt;/Parents&gt;
> +            &lt;Parents name=&quot;GrandFatherMarker&quot;/&gt;
> +        &lt;/Parents&gt;
> +    &lt;/Marker&gt;
> +    &lt;Message&gt;Msg&lt;/Message&gt;
> +    &lt;ContextMap&gt;
> +        &lt;item key=&quot;MDC.B&quot; value=&quot;B_Value&quot;/&gt;
> +        &lt;item key=&quot;MDC.A&quot; value=&quot;A_Value&quot;/&gt;
> +    &lt;/ContextMap&gt;
> +    &lt;ContextStack&gt;
> +        &lt;ContextStack&gt;stack_msg1&lt;/ContextStack&gt;
> +        &lt;ContextStack&gt;stack_msg2&lt;/ContextStack&gt;
> +    &lt;/ContextStack&gt;
> +    &lt;Source class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;54&quot;/&gt;
> +    &lt;Thrown commonElementCount=&quot;0&quot; localizedMessage=&quot;testIOEx&quot; message=&quot;testIOEx&quot; name=&quot;java.io.IOException&quot;&gt;
> +        &lt;Cause commonElementCount=&quot;27&quot; localizedMessage=&quot;testNPEx&quot; message=&quot;testNPEx&quot; name=&quot;java.lang.NullPointerException&quot;&gt;
> +            &lt;ExtendedStackTrace&gt;
> +                &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;53&quot; exact=&quot;false&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +            &lt;/ExtendedStackTrace&gt;
> +        &lt;/Cause&gt;
> +        &lt;ExtendedStackTrace&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;56&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testAllFeatures&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;122&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testLocationOnCompactOnMdcOn&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;270&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;sun.reflect.DelegatingMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;java.lang.reflect.Method&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod$1&quot; method=&quot;runReflectiveCall&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;47&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.model.ReflectiveCallable&quot; method=&quot;run&quot; file=&quot;ReflectiveCallable.java&quot; line=&quot;12&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod&quot; method=&quot;invokeExplosively&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;44&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.InvokeMethod&quot; method=&quot;evaluate&quot; file=&quot;InvokeMethod.java&quot; line=&quot;17&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runLeaf&quot; file=&quot;ParentRunner.java&quot; line=&quot;271&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;70&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$3&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;238&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$1&quot; method=&quot;schedule&quot; file=&quot;ParentRunner.java&quot; line=&quot;63&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runChildren&quot; file=&quot;ParentRunner.java&quot; line=&quot;236&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;access$000&quot; file=&quot;ParentRunner.java&quot; line=&quot;53&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$2&quot; method=&quot;evaluate&quot; file=&quot;ParentRunner.java&quot; line=&quot;229&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunBefores&quot; method=&quot;evaluate&quot; file=&quot;RunBefores.java&quot; line=&quot;26&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunAfters&quot; method=&quot;evaluate&quot; file=&quot;RunAfters.java&quot; line=&quot;27&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;309&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference&quot; method=&quot;run&quot; file=&quot;JUnit4TestReference.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.TestExecution&quot; method=&quot;run&quot; file=&quot;TestExecution.java&quot; line=&quot;38&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;467&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;683&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;run&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;390&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +            &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;main&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;197&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +        &lt;/ExtendedStackTrace&gt;
> +        &lt;Suppressed&gt;
> +            &lt;Suppressed commonElementCount=&quot;0&quot; localizedMessage=&quot;I am suppressed exception 1&quot; message=&quot;I am suppressed exception 1&quot; name=&quot;java.lang.IndexOutOfBoundsException&quot;&gt;
> +                &lt;ExtendedStackTrace&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;57&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testAllFeatures&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;122&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testLocationOnCompactOnMdcOn&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;270&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;sun.reflect.DelegatingMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;java.lang.reflect.Method&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod$1&quot; method=&quot;runReflectiveCall&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;47&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.model.ReflectiveCallable&quot; method=&quot;run&quot; file=&quot;ReflectiveCallable.java&quot; line=&quot;12&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod&quot; method=&quot;invokeExplosively&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;44&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.InvokeMethod&quot; method=&quot;evaluate&quot; file=&quot;InvokeMethod.java&quot; line=&quot;17&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runLeaf&quot; file=&quot;ParentRunner.java&quot; line=&quot;271&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;70&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$3&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;238&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$1&quot; method=&quot;schedule&quot; file=&quot;ParentRunner.java&quot; line=&quot;63&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runChildren&quot; file=&quot;ParentRunner.java&quot; line=&quot;236&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;access$000&quot; file=&quot;ParentRunner.java&quot; line=&quot;53&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$2&quot; method=&quot;evaluate&quot; file=&quot;ParentRunner.java&quot; line=&quot;229&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunBefores&quot; method=&quot;evaluate&quot; file=&quot;RunBefores.java&quot; line=&quot;26&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunAfters&quot; method=&quot;evaluate&quot; file=&quot;RunAfters.java&quot; line=&quot;27&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;309&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference&quot; method=&quot;run&quot; file=&quot;JUnit4TestReference.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.TestExecution&quot; method=&quot;run&quot; file=&quot;TestExecution.java&quot; line=&quot;38&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;467&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;683&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;run&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;390&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;main&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;197&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                &lt;/ExtendedStackTrace&gt;
> +            &lt;/Suppressed&gt;
> +            &lt;Suppressed commonElementCount=&quot;0&quot; localizedMessage=&quot;I am suppressed exception 2&quot; message=&quot;I am suppressed exception 2&quot; name=&quot;java.lang.IndexOutOfBoundsException&quot;&gt;
> +                &lt;ExtendedStackTrace&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.LogEventFixtures&quot; method=&quot;createLogEvent&quot; file=&quot;LogEventFixtures.java&quot; line=&quot;58&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testAllFeatures&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;122&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.apache.logging.log4j.core.layout.XmlLayoutTest&quot; method=&quot;testLocationOnCompactOnMdcOn&quot; file=&quot;XmlLayoutTest.java&quot; line=&quot;270&quot; exact=&quot;true&quot; location=&quot;test-classes/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;sun.reflect.NativeMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;sun.reflect.DelegatingMethodAccessorImpl&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;java.lang.reflect.Method&quot; method=&quot;invoke&quot; line=&quot;-1&quot; exact=&quot;false&quot; location=&quot;?&quot; version=&quot;1.7.0_55&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod$1&quot; method=&quot;runReflectiveCall&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;47&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.model.ReflectiveCallable&quot; method=&quot;run&quot; file=&quot;ReflectiveCallable.java&quot; line=&quot;12&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.model.FrameworkMethod&quot; method=&quot;invokeExplosively&quot; file=&quot;FrameworkMethod.java&quot; line=&quot;44&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.InvokeMethod&quot; method=&quot;evaluate&quot; file=&quot;InvokeMethod.java&quot; line=&quot;17&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runLeaf&quot; file=&quot;ParentRunner.java&quot; line=&quot;271&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;70&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.BlockJUnit4ClassRunner&quot; method=&quot;runChild&quot; file=&quot;BlockJUnit4ClassRunner.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$3&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;238&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$1&quot; method=&quot;schedule&quot; file=&quot;ParentRunner.java&quot; line=&quot;63&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;runChildren&quot; file=&quot;ParentRunner.java&quot; line=&quot;236&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;access$000&quot; file=&quot;ParentRunner.java&quot; line=&quot;53&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner$2&quot; method=&quot;evaluate&quot; file=&quot;ParentRunner.java&quot; line=&quot;229&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunBefores&quot; method=&quot;evaluate&quot; file=&quot;RunBefores.java&quot; line=&quot;26&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.internal.runners.statements.RunAfters&quot; method=&quot;evaluate&quot; file=&quot;RunAfters.java&quot; line=&quot;27&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.junit.runners.ParentRunner&quot; method=&quot;run&quot; file=&quot;ParentRunner.java&quot; line=&quot;309&quot; exact=&quot;true&quot; location=&quot;junit-4.11.jar&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference&quot; method=&quot;run&quot; file=&quot;JUnit4TestReference.java&quot; line=&quot;50&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.TestExecution&quot; method=&quot;run&quot; file=&quot;TestExecution.java&quot; line=&quot;38&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;467&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;runTests&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;683&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;run&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;390&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                    &lt;ExtendedStackTrace class=&quot;org.eclipse.jdt.internal.junit.runner.RemoteTestRunner&quot; method=&quot;main&quot; file=&quot;RemoteTestRunner.java&quot; line=&quot;197&quot; exact=&quot;true&quot; location=&quot;.cp/&quot; version=&quot;?&quot;/&gt;
> +                &lt;/ExtendedStackTrace&gt;
> +            &lt;/Suppressed&gt;
> +        &lt;/Suppressed&gt;
> +    &lt;/Thrown&gt;
> +&lt;/Event&gt;
> +</pre>
> + * <p>
> + * If {@code complete="false"}, the appender does not write the XML processing instruction and the root element.
> + * </p>
> + * <p>
> + * This approach enforces the independence of the XmlLayout and the appender where you embed it.
> + * </p>
> + * <h4>Encoding</h4>
> + * <p>
> + * Appenders using this layout should have their {@code charset} set to {@code UTF-8} or {@code UTF-16}, otherwise events containing non
> + * ASCII characters could result in corrupted log files.
> + * </p>
> + * <h4>Pretty vs. compact XML</h4>
> + * <p>
> + * By default, the XML layout is not compact (compact = not "pretty") with {@code compact="false"}, which means the appender uses
> + * end-of-line characters and indents lines to format the XML. If {@code compact="true"}, then no end-of-line or indentation is used.
> + * Message content may contain, of course, end-of-lines.
> + * </p>
> + */
> +@Plugin(name = "XmlLayout", category = "Core", elementType = "layout", printObject = true)
> +public final class XmlLayout extends AbstractJacksonLayout {
> +
> +    private static final String ROOT_TAG = "Events";
> +
> +    protected XmlLayout(final boolean locationInfo, final boolean properties, final boolean complete, boolean compact, final Charset charset) {
> +        super(new JacksonFactory.XML().newWriter(locationInfo, properties, compact), charset, compact, complete);
> +    }
> +
> +    /**
> +     * Returns appropriate XML headers.
> +     * <ol>
> +     * <li>XML processing instruction</li>
> +     * <li>XML root element</li>
> +     * </ol>
> +     * 
> +     * @return a byte array containing the header.
> +     */
> +    @Override
> +    public byte[] getHeader() {
> +        if (!complete) {
> +            return null;
> +        }
> +        final StringBuilder buf = new StringBuilder();
> +        buf.append("<?xml version=\"1.0\" encoding=\"");
> +        buf.append(this.getCharset().name());
> +        buf.append("\"?>");
> +        buf.append(this.eol);
> +        // Make the log4j namespace the default namespace, no need to use more space with a namespace prefix.
> +        buf.append('<');
> +        buf.append(ROOT_TAG);
> +        buf.append(" xmlns=\"" + XMLConstants.XML_NAMESPACE + "\">");
> +        buf.append(this.eol);
> +        return buf.toString().getBytes(this.getCharset());
> +    }
> +
> +    /**
> +     * Returns appropriate XML footer.
> +     * 
> +     * @return a byte array containing the footer, closing the XML root element.
> +     */
> +    @Override
> +    public byte[] getFooter() {
> +        if (!complete) {
> +            return null;
> +        }
> +        return ("</" + ROOT_TAG + '>' + this.eol).getBytes(getCharset());
> +    }
> +
> +    /**
> +     * XmlLayout's content format is specified by:
> +     * <p/>
> +     * Key: "dtd" Value: "log4j-events.dtd"
> +     * <p/>
> +     * Key: "version" Value: "2.0"
> +     * 
> +     * @return Map of content format keys supporting XmlLayout
> +     */
> +    @Override
> +    public Map<String, String> getContentFormat() {
> +        final Map<String, String> result = new HashMap<String, String>();
> +        // result.put("dtd", "log4j-events.dtd");
> +        result.put("xsd", "log4j-events.xsd");
> +        result.put("version", "2.0");
> +        return result;
> +    }
> +
> +    @Override
> +    /**
> +     * @return The content type.
> +     */
> +    public String getContentType() {
> +        return "text/xml; charset=" + this.getCharset();
> +    }
> +
> +    /**
> +     * Creates an XML Layout.
> +     * 
> +     * @param locationInfoStr If "true", includes the location information in the generated XML.
> +     * @param propertiesStr If "true", includes the thread context in the generated XML.
> +     * @param completeStr If "true", includes the XML header and footer, defaults to "false".
> +     * @param compactStr If "true", does not use end-of-lines and indentation, defaults to "false".
> +     * @param charsetName The character set to use, if {@code null}, uses "UTF-8".
> +     * @return An XML Layout.
> +     */
> +    @PluginFactory
> +    public static XmlLayout createLayout(
> +            // @formatter:off
> +            @PluginAttribute("locationInfo") final String locationInfoStr,
> +            @PluginAttribute("properties") final String propertiesStr, 
> +            @PluginAttribute("complete") final String completeStr,
> +            @PluginAttribute("compact") final String compactStr, 
> +            @PluginAttribute("charset") final String charsetName)
> +            // @formatter:on
> +    {
> +        final Charset charset = Charsets.getSupportedCharset(charsetName, Charsets.UTF_8);
> +        final boolean info = Boolean.parseBoolean(locationInfoStr);
> +        final boolean props = Boolean.parseBoolean(propertiesStr);
> +        final boolean complete = Boolean.parseBoolean(completeStr);
> +        final boolean compact = Boolean.parseBoolean(compactStr);
> +        return new XmlLayout(info, props, complete, compact, charset);
> +    }
> +}
> 
> Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
> 
> Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java
> ------------------------------------------------------------------------------
>    svn:keywords = Id
> 
> Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MimeMessageBuilder.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MimeMessageBuilder.java?rev=1596613&r1=1596612&r2=1596613&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MimeMessageBuilder.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MimeMessageBuilder.java Wed May 21 16:31:17 2014
> @@ -26,7 +26,7 @@ import javax.mail.internet.MimeMessage;
> import org.apache.logging.log4j.core.util.Charsets;
> 
> /**
> - *  Helper class for SMTPManager.
> + *  Helper class for SmtpManager.
>  */
> public class MimeMessageBuilder {
>     private final MimeMessage message;
> 
> Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDnsAdvertiser.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java)
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDnsAdvertiser.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDnsAdvertiser.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java&r1=1596559&r2=1596613&rev=1596613&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDnsAdvertiser.java Wed May 21 16:31:17 2014
> @@ -36,14 +36,14 @@ import org.apache.logging.log4j.status.S
>  *
>  */
> @Plugin(name = "multicastdns", category = "Core", elementType = "advertiser", printObject = false)
> -public class MulticastDNSAdvertiser implements Advertiser {
> +public class MulticastDnsAdvertiser implements Advertiser {
>     protected static final Logger LOGGER = StatusLogger.getLogger();
>     private static Object jmDNS = initializeJMDNS();
> 
>     private static Class<?> jmDNSClass;
>     private static Class<?> serviceInfoClass;
> 
> -    public MulticastDNSAdvertiser()
> +    public MulticastDnsAdvertiser()
>     {
>         //no arg constructor for reflection
>     }
> 
> Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java)
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java&r1=1596559&r2=1596613&rev=1596613&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java Wed May 21 16:31:17 2014
> @@ -50,7 +50,7 @@ import org.apache.logging.log4j.util.Str
> /**
>  * Manager for sending SMTP events.
>  */
> -public class SMTPManager extends AbstractManager {
> +public class SmtpManager extends AbstractManager {
>     private static final SMTPManagerFactory FACTORY = new SMTPManagerFactory();
> 
>     private final Session session;
> @@ -61,7 +61,7 @@ public class SMTPManager extends Abstrac
> 
>     private final FactoryData data;
> 
> -    protected SMTPManager(final String name, final Session session, final MimeMessage message,
> +    protected SmtpManager(final String name, final Session session, final MimeMessage message,
>                           final FactoryData data) {
>         super(name);
>         this.session = session;
> @@ -74,7 +74,7 @@ public class SMTPManager extends Abstrac
>         buffer.add(event);
>     }
> 
> -    public static SMTPManager getSMTPManager(final String to, final String cc, final String bcc,
> +    public static SmtpManager getSMTPManager(final String to, final String cc, final String bcc,
>                                              final String from, final String replyTo,
>                                              final String subject, String protocol, final String host,
>                                              final int port, final String username, final String password,
> @@ -288,7 +288,7 @@ public class SMTPManager extends Abstrac
>                 .setRecipients(Message.RecipientType.TO, data.to).setRecipients(Message.RecipientType.CC, data.cc)
>                 .setRecipients(Message.RecipientType.BCC, data.bcc).setSubject(data.subject).getMimeMessage();
>         } catch (final MessagingException e) {
> -            LOGGER.error("Could not set SMTPAppender message options.", e);
> +            LOGGER.error("Could not set SmtpAppender message options.", e);
>             message = null;
>         }
>     }
> @@ -296,10 +296,10 @@ public class SMTPManager extends Abstrac
>     /**
>      * Factory to create the SMTP Manager.
>      */
> -    private static class SMTPManagerFactory implements ManagerFactory<SMTPManager, FactoryData> {
> +    private static class SMTPManagerFactory implements ManagerFactory<SmtpManager, FactoryData> {
> 
>         @Override
> -        public SMTPManager createManager(final String name, final FactoryData data) {
> +        public SmtpManager createManager(final String name, final FactoryData data) {
>             final String prefix = "mail." + data.protocol;
> 
>             final Properties properties = PropertiesUtil.getSystemProperties();
> @@ -331,11 +331,11 @@ public class SMTPManager extends Abstrac
>                     .setRecipients(Message.RecipientType.TO, data.to).setRecipients(Message.RecipientType.CC, data.cc)
>                     .setRecipients(Message.RecipientType.BCC, data.bcc).setSubject(data.subject).getMimeMessage();
>             } catch (final MessagingException e) {
> -                LOGGER.error("Could not set SMTPAppender message options.", e);
> +                LOGGER.error("Could not set SmtpAppender message options.", e);
>                 message = null;
>             }
> 
> -            return new SMTPManager(name, session, message, data);
> +            return new SmtpManager(name, session, message, data);
>         }
> 
>         private Authenticator buildAuthenticator(final String username, final String password) {
> 
> Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java)
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java&r1=1596559&r2=1596613&rev=1596613&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TcpSocketManager.java Wed May 21 16:31:17 2014
> @@ -37,7 +37,7 @@ import org.apache.logging.log4j.util.Str
> /**
>  * Manager of TCP Socket connections.
>  */
> -public class TCPSocketManager extends AbstractSocketManager {
> +public class TcpSocketManager extends AbstractSocketManager {
>     /**
>       The default reconnection delay (30000 milliseconds or 30 seconds).
>      */
> @@ -71,7 +71,7 @@ public class TCPSocketManager extends Ab
>      * @param immediateFail
>      * @param layout The Layout.
>      */
> -    public TCPSocketManager(final String name, final OutputStream os, final Socket sock, final InetAddress addr,
> +    public TcpSocketManager(final String name, final OutputStream os, final Socket sock, final InetAddress addr,
>                             final String host, final int port, final int delay, final boolean immediateFail,
>                             final Layout<? extends Serializable> layout) {
>         super(name, os, addr, host, port, layout);
> @@ -88,13 +88,13 @@ public class TCPSocketManager extends Ab
>     }
> 
>     /**
> -     * Obtain a TCPSocketManager.
> +     * Obtain a TcpSocketManager.
>      * @param host The host to connect to.
>      * @param port The port on the host.
>      * @param delay The interval to pause between retries.
> -     * @return A TCPSocketManager.
> +     * @return A TcpSocketManager.
>      */
> -    public static TCPSocketManager getSocketManager(final String host, int port, int delay,
> +    public static TcpSocketManager getSocketManager(final String host, int port, int delay,
>                                                     final boolean immediateFail, final Layout<? extends Serializable> layout ) {
>         if (Strings.isEmpty(host)) {
>             throw new IllegalArgumentException("A host name is required");
> @@ -105,7 +105,7 @@ public class TCPSocketManager extends Ab
>         if (delay == 0) {
>             delay = DEFAULT_RECONNECTION_DELAY;
>         }
> -        return (TCPSocketManager) getManager("TCP:" + host + ':' + port,
> +        return (TcpSocketManager) getManager("TCP:" + host + ':' + port,
>             new FactoryData(host, port, delay, immediateFail, layout), FACTORY);
>     }
> 
> @@ -147,10 +147,10 @@ public class TCPSocketManager extends Ab
>     }
> 
>     /**
> -     * TCPSocketManager's content format is specified by:<p/>
> +     * TcpSocketManager's content format is specified by:<p/>
>      * Key: "protocol" Value: "tcp"<p/>
>      * Key: "direction" Value: "out"
> -     * @return Map of content format keys supporting TCPSocketManager
> +     * @return Map of content format keys supporting TcpSocketManager
>      */
>     @Override
>     public Map<String, String> getContentFormat()
> @@ -250,11 +250,11 @@ public class TCPSocketManager extends Ab
>     }
> 
>     /**
> -     * Factory to create a TCPSocketManager.
> +     * Factory to create a TcpSocketManager.
>      */
> -    protected static class TCPSocketManagerFactory implements ManagerFactory<TCPSocketManager, FactoryData> {
> +    protected static class TCPSocketManagerFactory implements ManagerFactory<TcpSocketManager, FactoryData> {
>         @Override
> -        public TCPSocketManager createManager(final String name, final FactoryData data) {
> +        public TcpSocketManager createManager(final String name, final FactoryData data) {
> 
>             InetAddress address;
>             OutputStream os;
> @@ -267,16 +267,16 @@ public class TCPSocketManager extends Ab
>             try {
>                 final Socket socket = new Socket(data.host, data.port);
>                 os = socket.getOutputStream();
> -                return new TCPSocketManager(name, os, socket, address, data.host, data.port, data.delay,
> +                return new TcpSocketManager(name, os, socket, address, data.host, data.port, data.delay,
>                     data.immediateFail, data.layout);
>             } catch (final IOException ex) {
> -                LOGGER.error("TCPSocketManager (" + name + ") " + ex);
> +                LOGGER.error("TcpSocketManager (" + name + ") " + ex);
>                 os = new ByteArrayOutputStream();
>             }
>             if (data.delay == 0) {
>                 return null;
>             }
> -            return new TCPSocketManager(name, os, null, address, data.host, data.port, data.delay, data.immediateFail,
> +            return new TcpSocketManager(name, os, null, address, data.host, data.port, data.delay, data.immediateFail,
>                 data.layout);
>         }
>     }
> 
> Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TlsSocketManager.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java)
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TlsSocketManager.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TlsSocketManager.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java&r1=1596559&r2=1596613&rev=1596613&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TlsSocketManager.java Wed May 21 16:31:17 2014
> @@ -30,16 +30,16 @@ import javax.net.ssl.SSLSocketFactory;
> import org.apache.logging.log4j.Level;
> import org.apache.logging.log4j.core.Layout;
> import org.apache.logging.log4j.core.appender.ManagerFactory;
> -import org.apache.logging.log4j.core.net.ssl.SSLConfiguration;
> +import org.apache.logging.log4j.core.net.ssl.SslConfiguration;
> import org.apache.logging.log4j.util.Strings;
> 
> /**
>  *
>  */
> -public class TLSSocketManager extends TCPSocketManager {
> +public class TlsSocketManager extends TcpSocketManager {
>     public static final int DEFAULT_PORT = 6514;
>     private static final TLSSocketManagerFactory FACTORY = new TLSSocketManagerFactory();
> -    private final SSLConfiguration sslConfig;
> +    private final SslConfiguration sslConfig;
> 
>     /**
>      *
> @@ -54,21 +54,21 @@ public class TLSSocketManager extends TC
>      * @param immediateFail
>      * @param layout        The Layout.
>      */
> -    public TLSSocketManager(final String name, final OutputStream os, final Socket sock, final SSLConfiguration sslConfig, final InetAddress addr,
> +    public TlsSocketManager(final String name, final OutputStream os, final Socket sock, final SslConfiguration sslConfig, final InetAddress addr,
>                             final String host, final int port, final int delay, final boolean immediateFail, final Layout<? extends Serializable> layout) {
>         super(name, os, sock, addr, host, port, delay, immediateFail, layout);
>         this.sslConfig = sslConfig;
>     }
> 
>     private static class TLSFactoryData {
> -        protected SSLConfiguration sslConfig;
> +        protected SslConfiguration sslConfig;
>         private final String host;
>         private final int port;
>         private final int delay;
>         private final boolean immediateFail;
>         private final Layout<? extends Serializable> layout;
> 
> -        public TLSFactoryData(final SSLConfiguration sslConfig, final String host, final int port, final int delay, final boolean immediateFail,
> +        public TLSFactoryData(final SslConfiguration sslConfig, final String host, final int port, final int delay, final boolean immediateFail,
>                               final Layout<? extends Serializable> layout) {
>             this.host = host;
>             this.port = port;
> @@ -79,7 +79,7 @@ public class TLSSocketManager extends TC
>         }
>     }
> 
> -    public static TLSSocketManager getSocketManager(final SSLConfiguration sslConfig, final String host, int port,
> +    public static TlsSocketManager getSocketManager(final SslConfiguration sslConfig, final String host, int port,
>                                                     int delay, final boolean immediateFail, final Layout<? extends Serializable> layout ) {
>         if (Strings.isEmpty(host)) {
>             throw new IllegalArgumentException("A host name is required");
> @@ -90,7 +90,7 @@ public class TLSSocketManager extends TC
>         if (delay == 0) {
>             delay = DEFAULT_RECONNECTION_DELAY;
>         }
> -        return (TLSSocketManager) getManager("TLS:" + host + ':' + port,
> +        return (TlsSocketManager) getManager("TLS:" + host + ':' + port,
>                 new TLSFactoryData(sslConfig, host, port, delay, immediateFail, layout), FACTORY);
>     }
> 
> @@ -100,7 +100,7 @@ public class TLSSocketManager extends TC
>         return socketFactory.createSocket(host, port);
>     }
> 
> -    private static SSLSocketFactory createSSLSocketFactory(final SSLConfiguration sslConf) {
> +    private static SSLSocketFactory createSSLSocketFactory(final SslConfiguration sslConf) {
>         SSLSocketFactory socketFactory;
> 
>         if (sslConf != null) {
> @@ -113,7 +113,7 @@ public class TLSSocketManager extends TC
>     }
> 
> 
> -    private static class TLSSocketManagerFactory implements ManagerFactory<TLSSocketManager, TLSFactoryData> {
> +    private static class TLSSocketManagerFactory implements ManagerFactory<TlsSocketManager, TLSFactoryData> {
> 
>         private class TLSSocketManagerFactoryException extends Exception {
> 
> @@ -121,7 +121,7 @@ public class TLSSocketManager extends TC
>         }
> 
>         @Override
> -        public TLSSocketManager createManager(final String name, final TLSFactoryData data) {
> +        public TlsSocketManager createManager(final String name, final TLSFactoryData data) {
>             InetAddress address = null;
>             OutputStream os = null;
>             Socket socket = null;
> @@ -133,7 +133,7 @@ public class TLSSocketManager extends TC
>                 checkDelay(data.delay, os);
>             }
>             catch (final IOException e) {
> -                LOGGER.error("TLSSocketManager ({})", name, e);
> +                LOGGER.error("TlsSocketManager ({})", name, e);
>                 os = new ByteArrayOutputStream();
>             }
>             catch (final TLSSocketManagerFactoryException e) {
> @@ -171,8 +171,8 @@ public class TLSSocketManager extends TC
>             return socket;
>         }
> 
> -        private TLSSocketManager createManager(final String name, final OutputStream os, final Socket socket, final SSLConfiguration sslConfig, final InetAddress address, final String host, final int port, final int delay, final boolean immediateFail, final Layout<? extends Serializable> layout) {
> -            return new TLSSocketManager(name, os, socket, sslConfig, address, host, port, delay, immediateFail, layout);
> +        private TlsSocketManager createManager(final String name, final OutputStream os, final Socket socket, final SslConfiguration sslConfig, final InetAddress address, final String host, final int port, final int delay, final boolean immediateFail, final Layout<? extends Serializable> layout) {
> +            return new TlsSocketManager(name, os, socket, sslConfig, address, host, port, delay, immediateFail, layout);
>         }
>     }
> }
> 
> Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsManager.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSManager.java)
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsManager.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsManager.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSManager.java&r1=1596559&r2=1596613&rev=1596613&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSManager.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsManager.java Wed May 21 16:31:17 2014
> @@ -35,13 +35,13 @@ import org.apache.logging.log4j.core.app
> /**
>  * Base Class for Managers of JMS connections.
>  */
> -public abstract class AbstractJMSManager extends AbstractManager {
> +public abstract class AbstractJmsManager extends AbstractManager {
> 
>     /**
>      * The Constructor.
>      * @param name The name of the Appender.
>      */
> -    public AbstractJMSManager(final String name) {
> +    public AbstractJmsManager(final String name) {
>         super(name);
>     }
> 
> 
> Copied: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsReceiver.java (from r1596559, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSReceiver.java)
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsReceiver.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsReceiver.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSReceiver.java&r1=1596559&r2=1596613&rev=1596613&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJMSReceiver.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/jms/AbstractJmsReceiver.java Wed May 21 16:31:17 2014
> @@ -32,7 +32,7 @@ import org.apache.logging.log4j.core.Log
> /**
>  * Abstract base class for receiving LogEvents over JMS. This class expects all messages to be serialized log events.
>  */
> -public abstract class AbstractJMSReceiver extends LogEventListener implements javax.jms.MessageListener {
> +public abstract class AbstractJmsReceiver extends LogEventListener implements javax.jms.MessageListener {
> 
>     /**
>      * Logger to capture diagnostics.
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org