Checkstyle: field definition order, method order, format, line length

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2b3b8a30
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2b3b8a30
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2b3b8a30

Branch: refs/heads/LOG4J2-1136
Commit: 2b3b8a302ce8ae5b8a5e8988a0846ba114727ffb
Parents: 307d945
Author: rpopma <[email protected]>
Authored: Sun Oct 4 00:04:43 2015 +0200
Committer: Ralph Goers <[email protected]>
Committed: Sat Oct 3 23:08:06 2015 -0700

----------------------------------------------------------------------
 .../log4j/core/layout/AbstractCsvLayout.java    | 51 ++++++------
 .../core/layout/AbstractJacksonLayout.java      |  3 +-
 .../logging/log4j/core/layout/GelfLayout.java   | 32 ++++----
 .../logging/log4j/core/layout/HtmlLayout.java   | 22 ++---
 .../log4j/core/layout/PatternLayout.java        |  4 +-
 .../log4j/core/layout/Rfc5424Layout.java        | 86 +++++++++++---------
 .../logging/log4j/core/layout/SyslogLayout.java |  8 +-
 .../logging/log4j/test/layout/BasicLayout.java  |  8 +-
 8 files changed, 106 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b3b8a30/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractCsvLayout.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractCsvLayout.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractCsvLayout.java
index 2e98a65..fa945ac 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractCsvLayout.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractCsvLayout.java
@@ -30,35 +30,11 @@ import org.apache.commons.csv.QuoteMode;
  */
 public abstract class AbstractCsvLayout extends AbstractStringLayout {
 
-    private static final String CONTENT_TYPE = "text/csv";
     protected static final String DEFAULT_CHARSET = "UTF-8";
     protected static final String DEFAULT_FORMAT = "Default";
+    private static final String CONTENT_TYPE = "text/csv";
     private static final long serialVersionUID = 1L;
 
-    protected static CSVFormat createFormat(final String format, final 
Character delimiter, final Character escape, final Character quote, final 
QuoteMode quoteMode, final String nullString,
-            final String recordSeparator) {
-                CSVFormat csvFormat = CSVFormat.valueOf(format);
-                if (delimiter != null) {
-                    csvFormat = csvFormat.withDelimiter(delimiter);
-                }
-                if (escape != null) {
-                    csvFormat = csvFormat.withEscape(escape);
-                }
-                if (quote != null) {
-                    csvFormat = csvFormat.withQuote(quote);
-                }
-                if (quoteMode != null) {
-                    csvFormat = csvFormat.withQuoteMode(quoteMode);
-                }
-                if (nullString != null) {
-                    csvFormat = csvFormat.withNullString(nullString);
-                }
-                if (recordSeparator != null) {
-                    csvFormat = csvFormat.withRecordSeparator(recordSeparator);
-                }
-                return csvFormat;
-            }
-
     private final CSVFormat format;
 
     protected AbstractCsvLayout(final Charset charset, final CSVFormat 
csvFormat, final String header,
@@ -67,6 +43,30 @@ public abstract class AbstractCsvLayout extends 
AbstractStringLayout {
         this.format = csvFormat;
     }
 
+    protected static CSVFormat createFormat(final String format, final 
Character delimiter, final Character escape,
+            final Character quote, final QuoteMode quoteMode, final String 
nullString, final String recordSeparator) {
+        CSVFormat csvFormat = CSVFormat.valueOf(format);
+        if (delimiter != null) {
+            csvFormat = csvFormat.withDelimiter(delimiter);
+        }
+        if (escape != null) {
+            csvFormat = csvFormat.withEscape(escape);
+        }
+        if (quote != null) {
+            csvFormat = csvFormat.withQuote(quote);
+        }
+        if (quoteMode != null) {
+            csvFormat = csvFormat.withQuoteMode(quoteMode);
+        }
+        if (nullString != null) {
+            csvFormat = csvFormat.withNullString(nullString);
+        }
+        if (recordSeparator != null) {
+            csvFormat = csvFormat.withRecordSeparator(recordSeparator);
+        }
+        return csvFormat;
+    }
+
     @Override
     public String getContentType() {
         return CONTENT_TYPE + "; charset=" + this.getCharset();
@@ -75,5 +75,4 @@ public abstract class AbstractCsvLayout extends 
AbstractStringLayout {
     public CSVFormat getFormat() {
         return format;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b3b8a30/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractJacksonLayout.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractJacksonLayout.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractJacksonLayout.java
index 1f4d42e..ca966fb 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractJacksonLayout.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractJacksonLayout.java
@@ -26,9 +26,10 @@ import com.fasterxml.jackson.databind.ObjectWriter;
 
 abstract class AbstractJacksonLayout extends AbstractStringLayout {
 
-    private static final long serialVersionUID = 1L;
     protected static final String DEFAULT_EOL = "\r\n";
     protected static final String COMPACT_EOL = Strings.EMPTY;
+    private static final long serialVersionUID = 1L;
+
     protected final String eol;
     protected final ObjectWriter objectWriter;
     protected final boolean compact;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b3b8a30/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
index 6433f91..be71c29 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
@@ -94,7 +94,6 @@ public final class GelfLayout extends AbstractStringLayout {
         };
 
         public abstract DeflaterOutputStream 
createDeflaterOutputStream(OutputStream os) throws IOException;
-
     }
 
     private static final char C = ',';
@@ -106,6 +105,20 @@ public final class GelfLayout extends AbstractStringLayout 
{
     private static final BigDecimal TIME_DIVISOR = new BigDecimal(1000);
 
     private static ThreadLocal<StringBuilder> strBuilder = 
newStringBuilderThreadLocal();
+
+    private final KeyValuePair[] additionalFields;
+    private final int compressionThreshold;
+    private final CompressionType compressionType;
+    private final String host;
+
+    public GelfLayout(final String host, final KeyValuePair[] 
additionalFields, final CompressionType compressionType,
+            final int compressionThreshold) {
+        super(StandardCharsets.UTF_8);
+        this.host = host;
+        this.additionalFields = additionalFields;
+        this.compressionType = compressionType;
+        this.compressionThreshold = compressionThreshold;
+    }
     
     @PluginFactory
     public static GelfLayout createLayout(
@@ -140,23 +153,6 @@ public final class GelfLayout extends AbstractStringLayout 
{
         return new BigDecimal(timeMillis).divide(TIME_DIVISOR).toPlainString();
     }
 
-    private final KeyValuePair[] additionalFields;
-
-    private final int compressionThreshold;
-
-    private final CompressionType compressionType;
-
-    private final String host;
-
-    public GelfLayout(final String host, final KeyValuePair[] 
additionalFields, final CompressionType compressionType,
-            final int compressionThreshold) {
-        super(StandardCharsets.UTF_8);
-        this.host = host;
-        this.additionalFields = additionalFields;
-        this.compressionType = compressionType;
-        this.compressionThreshold = compressionThreshold;
-    }
-
     private byte[] compress(final byte[] bytes) {
         try {
             final ByteArrayOutputStream baos = new 
ByteArrayOutputStream(compressionThreshold / 8);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b3b8a30/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java
index a12ee47..c80d560 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java
@@ -50,28 +50,28 @@ import org.apache.logging.log4j.core.util.Transform;
 @Plugin(name = "HtmlLayout", category = Node.CATEGORY, elementType = 
Layout.ELEMENT_TYPE, printObject = true)
 public final class HtmlLayout extends AbstractStringLayout {
 
-    private static final long serialVersionUID = 1L;
+    /**
+     * Default font family: {@value}.
+     */
+    public static final String DEFAULT_FONT_FAMILY = "arial,sans-serif";
 
+    private static final long serialVersionUID = 1L;
     private static final String TRACE_PREFIX = "<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;";
-
     private static final String REGEXP = Constants.LINE_SEPARATOR.equals("\n") 
? "\n" : Constants.LINE_SEPARATOR + "|\n";
-
     private static final String DEFAULT_TITLE = "Log4j Log Messages";
-
     private static final String DEFAULT_CONTENT_TYPE = "text/html";
 
-    public static final String DEFAULT_FONT_FAMILY = "arial,sans-serif";
+    private static ThreadLocal<StringBuilder> strBuilder = 
newStringBuilderThreadLocal();
 
     private final long jvmStartTime = 
ManagementFactory.getRuntimeMXBean().getStartTime();
-
-    private static ThreadLocal<StringBuilder> strBuilder = 
newStringBuilderThreadLocal();
     
     // Print no location info by default
     private final boolean locationInfo;
-
     private final String title;
-
     private final String contentType;
+    private final String font;
+    private final String fontSize;
+    private final String headerSize;
 
     /**Possible font sizes */
     public static enum FontSize {
@@ -102,10 +102,6 @@ public final class HtmlLayout extends AbstractStringLayout 
{
         }
     }
 
-    private final String font;
-    private final String fontSize;
-    private final String headerSize;
-
     private HtmlLayout(final boolean locationInfo, final String title, final 
String contentType, final Charset charset,
             final String font, final String fontSize, final String headerSize) 
{
         super(charset);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b3b8a30/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
index e5b78d3..12207f4 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
@@ -55,8 +55,6 @@ import org.apache.logging.log4j.core.pattern.RegexReplacement;
 @Plugin(name = "PatternLayout", category = Node.CATEGORY, elementType = 
Layout.ELEMENT_TYPE, printObject = true)
 public final class PatternLayout extends AbstractStringLayout {
 
-    private static final long serialVersionUID = 1L;
-
     /**
      * Default pattern string for log output. Currently set to the
      * string <b>"%m%n"</b> which just prints the application supplied
@@ -81,6 +79,8 @@ public final class PatternLayout extends AbstractStringLayout 
{
     /** Key to identify pattern converters. */
     public static final String KEY = "Converter";
 
+    private static final long serialVersionUID = 1L;
+
     private static ThreadLocal<StringBuilder> strBuilder = 
newStringBuilderThreadLocal();
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b3b8a30/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
index e062798..5775a86 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java
@@ -56,7 +56,6 @@ import org.apache.logging.log4j.message.StructuredDataMessage;
 import org.apache.logging.log4j.util.StringBuilders;
 import org.apache.logging.log4j.util.Strings;
 
-
 /**
  * Formats a log event in accordance with RFC 5424.
  *
@@ -65,10 +64,6 @@ import org.apache.logging.log4j.util.Strings;
 @Plugin(name = "Rfc5424Layout", category = Node.CATEGORY, elementType = 
Layout.ELEMENT_TYPE, printObject = true)
 public final class Rfc5424Layout extends AbstractStringLayout {
 
-    private static final long serialVersionUID = 1L;
-
-    private static final String LF = "\n";
-
     /**
      * Not a very good default - it is the Apache Software Foundation's 
enterprise number.
      */
@@ -82,11 +77,18 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
      */
     public static final Pattern NEWLINE_PATTERN = Pattern.compile("\\r?\\n");
     /**
-     * Match characters which require escaping
+     * Match characters which require escaping.
      */
     public static final Pattern PARAM_VALUE_ESCAPE_PATTERN = 
Pattern.compile("[\\\"\\]\\\\]");
 
+    /**
+     * Default MDC ID: {@value} .
+     */
     public static final String DEFAULT_MDCID = "mdc";
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String LF = "\n";
     private static final int TWO_DIGITS = 10;
     private static final int THREE_DIGITS = 100;
     private static final int MILLIS_PER_MINUTE = 60000;
@@ -95,7 +97,7 @@ public final class Rfc5424Layout extends AbstractStringLayout 
{
     private static final String COMPONENT_KEY = "RFC5424-Converter";
 
     private static ThreadLocal<StringBuilder> strBuilder = 
newStringBuilderThreadLocal();
-    
+
     private final Facility facility;
     private final String defaultId;
     private final int enterpriseNumber;
@@ -121,14 +123,13 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
     private String timestamppStr;
 
     private final List<PatternFormatter> exceptionFormatters;
-    private final Map<String,  FieldFormatter> fieldFormatters;
+    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) {
+            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);
@@ -292,7 +293,7 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
         buffer.append(">1 ");
     }
 
-    private void appendTimestamp(final StringBuilder buffer, final long 
milliseconds)  {
+    private void appendTimestamp(final StringBuilder buffer, final long 
milliseconds) {
         buffer.append(computeTimeStampString(milliseconds));
     }
 
@@ -333,7 +334,8 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
     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();
+        final String text = (message instanceof StructuredDataMessage) ? 
message.getFormat() : message
+                .getFormattedMessage();
 
         if (text != null && text.length() > 0) {
             buffer.append(' ').append(escapeNewlines(text, escapeNewLine));
@@ -355,7 +357,7 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
         final Message message = event.getMessage();
         final boolean isStructured = message instanceof StructuredDataMessage;
 
-        if (!isStructured && (fieldFormatters!= null && 
fieldFormatters.isEmpty()) && !includeMdc) {
+        if (!isStructured && (fieldFormatters != null && 
fieldFormatters.isEmpty()) && !includeMdc) {
             buffer.append('-');
             return;
         }
@@ -368,7 +370,7 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
         }
 
         if (fieldFormatters != null) {
-            for (final Map.Entry<String, FieldFormatter> sdElement: 
fieldFormatters.entrySet()) {
+            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);
@@ -408,7 +410,7 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
             return;
         }
 
-        for (final Map.Entry<String, StructuredDataElement> entry: 
sdElements.entrySet()) {
+        for (final Map.Entry<String, StructuredDataElement> entry : 
sdElements.entrySet()) {
             formatStructuredElement(entry.getKey(), mdcPrefix, 
entry.getValue(), buffer, checker);
         }
     }
@@ -494,7 +496,7 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
     }
 
     private void formatStructuredElement(final String id, final String prefix, 
final StructuredDataElement data,
-                                         final StringBuilder sb, final 
ListChecker checker) {
+            final StringBuilder sb, final ListChecker checker) {
         if ((id == null && defaultId == null) || data.discard()) {
             return;
         }
@@ -608,32 +610,34 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
     /**
      * 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 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 enterpriseNumber 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 newLine          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 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 newLine 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.
+     * @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(
+            // @formatter:off
             @PluginAttribute(value = "facility", defaultString = "LOCAL0") 
final Facility facility,
             @PluginAttribute("id") final String id,
-            @PluginAttribute(value = "enterpriseNumber", defaultInt = 
DEFAULT_ENTERPRISE_NUMBER) final int enterpriseNumber,
+            @PluginAttribute(value = "enterpriseNumber", defaultInt = 
DEFAULT_ENTERPRISE_NUMBER)
+            final int enterpriseNumber,
             @PluginAttribute(value = "includeMDC", defaultBoolean = true) 
final boolean includeMDC,
             @PluginAttribute(value = "mdcId", defaultString = DEFAULT_MDCID) 
final String mdcId,
             @PluginAttribute("mdcPrefix") final String mdcPrefix,
@@ -646,17 +650,19 @@ public final class Rfc5424Layout extends 
AbstractStringLayout {
             @PluginAttribute("mdcIncludes") String includes,
             @PluginAttribute("mdcRequired") final String required,
             @PluginAttribute("exceptionPattern") final String exceptionPattern,
-            @PluginAttribute(value = "useTlsMessageFormat", defaultBoolean = 
false) final boolean useTlsMessageFormat, // RFC 5425
+            // RFC 5425
+            @PluginAttribute(value = "useTlsMessageFormat", defaultBoolean = 
false) final boolean useTlsMessageFormat,
             @PluginElement("LoggerFields") final LoggerFields[] loggerFields,
             @PluginConfiguration final Configuration config) {
+        // @formatter:on
         if (includes != null && excludes != null) {
             LOGGER.error("mdcIncludes and mdcExcludes are mutually exclusive. 
Includes wil be ignored");
             includes = null;
         }
 
-        return new Rfc5424Layout(config, facility, id, enterpriseNumber, 
includeMDC, newLine, escapeNL, mdcId, mdcPrefix,
-                eventPrefix, appName, msgId, excludes, includes, required, 
StandardCharsets.UTF_8, exceptionPattern,
-                useTlsMessageFormat, loggerFields);
+        return new Rfc5424Layout(config, facility, id, enterpriseNumber, 
includeMDC, newLine, escapeNL, mdcId,
+                mdcPrefix, eventPrefix, appName, msgId, excludes, includes, 
required, StandardCharsets.UTF_8,
+                exceptionPattern, useTlsMessageFormat, loggerFields);
     }
 
     private class FieldFormatter {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b3b8a30/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java
index 350e217..b1d961d 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java
@@ -43,15 +43,15 @@ import org.apache.logging.log4j.util.Chars;
 @Plugin(name = "SyslogLayout", category = Node.CATEGORY, elementType = 
Layout.ELEMENT_TYPE, printObject = true)
 public final class SyslogLayout extends AbstractStringLayout {
 
-    private static final long serialVersionUID = 1L;
-
-    private static ThreadLocal<StringBuilder> strBuilder = 
newStringBuilderThreadLocal();
-
     /**
      * Match newlines in a platform-independent manner.
      */
     public static final Pattern NEWLINE_PATTERN = Pattern.compile("\\r?\\n");
 
+    private static final long serialVersionUID = 1L;
+
+    private static ThreadLocal<StringBuilder> strBuilder = 
newStringBuilderThreadLocal();
+
     private final Facility facility;
     private final boolean includeNewLine;
     private final String escapeNewLine;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b3b8a30/log4j-core/src/test/java/org/apache/logging/log4j/test/layout/BasicLayout.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/test/layout/BasicLayout.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/test/layout/BasicLayout.java
index 7d06bd7..b6baf87 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/test/layout/BasicLayout.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/test/layout/BasicLayout.java
@@ -34,15 +34,15 @@ public class BasicLayout extends AbstractStringLayout {
     private static final long serialVersionUID = 1L;
     private static final String HEADER = "Header" + Constants.LINE_SEPARATOR;
 
+    public BasicLayout(final Charset charset) {
+        super(charset);
+    }
+
     @Override
     public byte[] getHeader() {
         return getBytes(HEADER);
     }
 
-    public BasicLayout(final Charset charset) {
-        super(charset);
-    }
-
     @Override
     public String toSerializable(final LogEvent event) {
         return event.getMessage().getFormattedMessage() + 
Constants.LINE_SEPARATOR;

Reply via email to