logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <boa...@gmail.com>
Subject Fwd: svn commit: r1597494 - in /logging/log4j/log4j2/trunk: log4j-1.2-api/src/test/java/org/apache/log4j/ log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/ log4j-core/src/main/java/org/apache/logging/log4j/core/config/ log4j-core/src/...
Date Mon, 26 May 2014 00:28:37 GMT
I'll note that this builder style is very common in HttpComponents
(including the use of custom() as a method to create the builder).

---------- Forwarded message ----------
From: <mattsicker@apache.org>
Date: 25 May 2014 19:23
Subject: svn commit: r1597494 - in /logging/log4j/log4j2/trunk:
log4j-1.2-api/src/test/java/org/apache/log4j/
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/
log4j-core/src/main/java/org/apache/logging/log4j/core/config/
log4j-core/src/...
To: commits@logging.apache.org


Author: mattsicker
Date: Mon May 26 00:23:30 2014
New Revision: 1597494

URL: http://svn.apache.org/r1597494
Log:
Migrate PatternLayout to use Builder class.

  - Replaced usages of createCustomLayout() with custom()...build()
  chains.
  - Updated DefaultConfiguration to use the builder without causing
  an infinite recursion loop.
  - Fall back to a new DefaultConfiguration() in case no
  Configuration is specified in builder (can help prevent NPEs where
  config is assumed non-null).
  - Noted where code is duplicated between DefaultConfiguration and
  AbstractConfiguration.
  - Deleted the createCustomLayout() methods from PatternLayout.

Modified:

logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/CategoryTest.java

logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/LoggerTest.java

logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/ColumnConfig.java

logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java

logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java

logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java

logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java

logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java

logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java

logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsQueueTest.java

logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsTopicTest.java

logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java

Modified:
logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/CategoryTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/CategoryTest.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/CategoryTest.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/CategoryTest.java
Mon May 26 00:23:30 2014
@@ -161,7 +161,7 @@ public class CategoryTest {
     @Test
     public void testClassName() {
         final Category category = Category.getInstance("TestCategory");
-        final Layout<String> layout = PatternLayout.createCustomLayout("%d
%p %C{1.} [%t] %m%n");
+        final Layout<String> layout =
PatternLayout.custom().withPattern("%d %p %C{1.} [%t] %m%n").build();
         final ListAppender appender = new ListAppender("List2", null,
layout, false, false);
         appender.start();
         category.setAdditivity(false);

Modified:
logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/LoggerTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/LoggerTest.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/LoggerTest.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/LoggerTest.java
Mon May 26 00:23:30 2014
@@ -456,7 +456,7 @@ public class LoggerTest {
     @Test
     @SuppressWarnings("deprecation")
     public void testLog() {
-        final PatternLayout layout = PatternLayout.createCustomLayout("%d
%C %L %m");
+        final PatternLayout layout =
PatternLayout.custom().withPattern("%d %C %L %m").build();
         final ListAppender appender = new ListAppender("List", null,
layout, false, false);
         appender.start();
         final Logger root = Logger.getRootLogger();

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/ColumnConfig.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/ColumnConfig.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/ColumnConfig.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/ColumnConfig.java
Mon May 26 00:23:30 2014
@@ -129,10 +129,13 @@ public final class ColumnConfig {
             return new ColumnConfig(name, null, literalValue, false,
false, false);
         }
         if (isPattern) {
-            return new ColumnConfig(
-                    name, PatternLayout.createLayout(pattern, config,
null, null, false, false, null, null), null,
-                    false, isUnicode, isClob
-            );
+            final PatternLayout layout =
+                PatternLayout.custom()
+                    .withPattern(pattern)
+                    .withConfiguration(config)
+                    .withAlwaysWriteExceptions(false)
+                    .build();
+            return new ColumnConfig(name, layout, null, false, isUnicode,
isClob);
         }

         LOGGER.error("To configure a column you must specify a pattern or
literal or set isEventDate to true.");

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
Mon May 26 00:23:30 2014
@@ -166,7 +166,7 @@ public abstract class AbstractConfigurat
     public void stop() {
         this.setStopping();
         LOGGER.trace("AbstractConfiguration stopping...");
-
+
         // LOG4J2-392 first stop AsyncLogger Disruptor thread
         final LoggerContextFactory factory = LogManager.getFactory();
         if (factory instanceof Log4jContextFactory) {
@@ -376,9 +376,12 @@ public abstract class AbstractConfigurat
     }

     private void setToDefault() {
+        // TODO: reduce duplication between this method and
DefaultConfiguration constructor
         setName(DefaultConfiguration.DEFAULT_NAME);
-        final Layout<? extends Serializable> layout =
-                PatternLayout.createCustomLayout("%d{HH:mm:ss.SSS}
[%thread] %-5level %logger{36} - %msg%n");
+        final Layout<? extends Serializable> layout =
PatternLayout.custom()
+            .withPattern(DefaultConfiguration.DEFAULT_PATTERN)
+            .withConfiguration(this)
+            .build();
         final Appender appender = ConsoleAppender.createAppender(layout,
null, "SYSTEM_OUT", "Console", "false",
             "true");
         appender.start();

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
Mon May 26 00:23:30 2014
@@ -52,8 +52,10 @@ public class DefaultConfiguration extend
     public DefaultConfiguration() {

         setName(DEFAULT_NAME);
-        final Layout<? extends Serializable> layout =
-                PatternLayout.createCustomLayout(DEFAULT_PATTERN);
+        final Layout<? extends Serializable> layout =
PatternLayout.custom()
+            .withPattern(DEFAULT_PATTERN)
+            .withConfiguration(this)
+            .build();
         final Appender appender =
                 ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT",
"Console", "false", "true");
         appender.start();

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
Mon May 26 00:23:30 2014
@@ -23,12 +23,15 @@ import java.util.Map;

 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.DefaultConfiguration;
 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.PluginBuilderFactory;
 import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
 import org.apache.logging.log4j.core.config.plugins.PluginDefault;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import
org.apache.logging.log4j.core.config.plugins.util.ConfigurablePluginBuilder;
 import org.apache.logging.log4j.core.pattern.LogEventPatternConverter;
 import org.apache.logging.log4j.core.pattern.PatternFormatter;
 import org.apache.logging.log4j.core.pattern.PatternParser;
@@ -176,7 +179,7 @@ public final class PatternLayout extends

     /**
      * Gets the conversion pattern.
-     *
+     *
      * @return the conversion pattern.
      */
     public String getConversionPattern() {
@@ -245,7 +248,7 @@ public final class PatternLayout extends

     /**
      * Create a pattern layout.
-     *
+     *
      * @param pattern
      *        The pattern. If not specified, defaults to
DEFAULT_CONVERSION_PATTERN.
      * @param config
@@ -286,30 +289,101 @@ public final class PatternLayout extends
      * @see #DEFAULT_CONVERSION_PATTERN Default conversion pattern
      */
     public static PatternLayout createDefaultLayout() {
-        return createCustomLayout(DEFAULT_CONVERSION_PATTERN);
+        return custom().build();
     }

     /**
-     * Creates a PatternLayout using a custom layout and the default
options elsewhere.
-     *
-     * @param layout the conversion pattern layout to use.
-     * @return the PatternLayout.
+     * Creates a builder for a custom PatternLayout.
+     * @return a PatternLayout builder.
      */
-    public static PatternLayout createCustomLayout(final String layout) {
-        return createCustomLayout(layout, null);
+    @PluginBuilderFactory
+    public static Builder custom() {
+        return new Builder();
     }

     /**
-     * Creates a PatternLayout using a specific Configuration, custom
pattern conversion layout, and default options
-     * for everything else.
-     *
-     * @param layout the conversion pattern layout to use.
-     * @param config The Configuration. Some Converters require access to
the Interpolator.
-     * @return the PatternLayout.
+     * Custom PatternLayout builder. Use the {@link PatternLayout#custom()
builder factory method} to create this.
      */
-    public static PatternLayout createCustomLayout(final String layout,
final Configuration config) {
-        return new PatternLayout(
-            config, null, layout, Charsets.UTF_8, true, false, null, null
-        );
+    public static class Builder implements
ConfigurablePluginBuilder<PatternLayout> {
+
+        @PluginAttribute("pattern")
+        private String pattern = PatternLayout.DEFAULT_CONVERSION_PATTERN;
+
+        @PluginConfiguration
+        private Configuration configuration = null;
+
+        @PluginElement("Replace")
+        private RegexReplacement regexReplacement = null;
+
+        @PluginAttribute("charset")
+        private Charset charset = Charsets.UTF_8;
+
+        @PluginAttribute("alwaysWriteExceptions")
+        private boolean alwaysWriteExceptions = true;
+
+        @PluginAttribute("noConsoleNoAnsi")
+        private boolean noConsoleNoAnsi = false;
+
+        @PluginAttribute("header")
+        private String header = null;
+
+        @PluginAttribute("footer")
+        private String footer = null;
+
+        private Builder() {
+        }
+
+        // TODO: move javadocs from PluginFactory to here
+
+        public Builder withPattern(final String pattern) {
+            this.pattern = pattern;
+            return this;
+        }
+
+
+        public Builder withConfiguration(final Configuration
configuration) {
+            this.configuration = configuration;
+            return this;
+        }
+
+        public Builder withRegexReplacement(final RegexReplacement
regexReplacement) {
+            this.regexReplacement = regexReplacement;
+            return this;
+        }
+
+        public Builder withCharset(final Charset charset) {
+            this.charset = charset;
+            return this;
+        }
+
+        public Builder withAlwaysWriteExceptions(final boolean
alwaysWriteExceptions) {
+            this.alwaysWriteExceptions = alwaysWriteExceptions;
+            return this;
+        }
+
+        public Builder withNoConsoleNoAnsi(final boolean noConsoleNoAnsi) {
+            this.noConsoleNoAnsi = noConsoleNoAnsi;
+            return this;
+        }
+
+        public Builder withHeader(final String header) {
+            this.header = header;
+            return this;
+        }
+
+        public Builder withFooter(final String footer) {
+            this.footer = footer;
+            return this;
+        }
+
+        @Override
+        public PatternLayout build() {
+            // fall back to DefaultConfiguration
+            if (configuration == null) {
+                configuration = new DefaultConfiguration();
+            }
+            return new PatternLayout(configuration, regexReplacement,
pattern, charset, alwaysWriteExceptions,
+                noConsoleNoAnsi, header, footer);
+        }
     }
 }

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
Mon May 26 00:23:30 2014
@@ -66,7 +66,7 @@ public class FileAppenderTest {

     @Test
     public void testSmallestBufferSize() throws Exception {
-        final Layout<String> layout =
PatternLayout.createCustomLayout(PatternLayout.SIMPLE_CONVERSION_PATTERN);
+        final Layout<String> layout =
PatternLayout.custom().withPattern(PatternLayout.SIMPLE_CONVERSION_PATTERN).build();
         final String bufferSizeStr = "1";
         final FileAppender appender =
FileAppender.createAppender(FILENAME, "true", "false", "test", "false",
"false",
                 "false", bufferSizeStr, layout, null, "false", null, null);
@@ -160,7 +160,7 @@ public class FileAppenderTest {
     }

     private static void writer(final boolean lock, final int count, final
String name) throws Exception {
-        final Layout<String> layout =
PatternLayout.createCustomLayout(PatternLayout.SIMPLE_CONVERSION_PATTERN);
+        final Layout<String> layout =
PatternLayout.custom().withPattern(PatternLayout.SIMPLE_CONVERSION_PATTERN).build();
         final FileAppender app = FileAppender.createAppender(FILENAME,
"true", Boolean.toString(lock), "test", "false",
                 "false", "false", null, layout, null, "false", null, null);
         app.start();

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
Mon May 26 00:23:30 2014
@@ -72,8 +72,10 @@ public class CustomConfigurationTest {
                 break;
             }
         }
-        final Layout<? extends Serializable> layout =
-
 PatternLayout.createCustomLayout(PatternLayout.SIMPLE_CONVERSION_PATTERN,
config);
+        final Layout<? extends Serializable> layout =
PatternLayout.custom()
+            .withPattern(PatternLayout.SIMPLE_CONVERSION_PATTERN)
+            .withConfiguration(config)
+            .build();
         Appender appender = FileAppender.createAppender(LOG_FILE, "false",
"false", "File", "true",
             "false", "false", "4000", layout, null, "false", null, config);
         appender.start();

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
Mon May 26 00:23:30 2014
@@ -84,7 +84,10 @@ public class PatternLayoutTest {
         }

         // set up appender
-        final PatternLayout layout =
PatternLayout.createCustomLayout(msgPattern, ctx.getConfiguration());
+        final PatternLayout layout = PatternLayout.custom()
+            .withPattern(msgPattern)
+            .withConfiguration(ctx.getConfiguration())
+            .build();
         // FileOutputStream fos = new FileOutputStream(OUTPUT_FILE +
"_mdc");
         final FileAppender appender =
FileAppender.createAppender(OUTPUT_FILE + "_mdc", "false", "false", "File",
                 "false", "true", "false", null, layout, null, "false",
null, null);
@@ -150,7 +153,10 @@ public class PatternLayoutTest {
     @Test
     public void testRegex() throws Exception {
         final LoggerContext ctx = (LoggerContext) LogManager.getContext();
-        final PatternLayout layout =
PatternLayout.createCustomLayout(regexPattern, ctx.getConfiguration());
+        final PatternLayout layout = PatternLayout.custom()
+            .withPattern(regexPattern)
+            .withConfiguration(ctx.getConfiguration())
+            .build();
         final LogEvent event = new
Log4jLogEvent(this.getClass().getName(), null,
                 "org.apache.logging.log4j.core.Logger", Level.INFO, new
SimpleMessage("Hello, world!"), null);
         final byte[] result = layout.toByteArray(event);
@@ -159,7 +165,10 @@ public class PatternLayoutTest {

     private void testUnixTime(String pattern) throws Exception {
         final LoggerContext ctx = (LoggerContext) LogManager.getContext();
-        final PatternLayout layout =
PatternLayout.createCustomLayout(pattern + " %m", ctx.getConfiguration());
+        final PatternLayout layout = PatternLayout.custom()
+            .withPattern(pattern + " %m")
+            .withConfiguration(ctx.getConfiguration())
+            .build();
         final LogEvent event1 = new
Log4jLogEvent(this.getClass().getName(), null,
                 "org.apache.logging.log4j.core.Logger", Level.INFO, new
SimpleMessage("Hello, world 1!"), null);
         final byte[] result1 = layout.toByteArray(event1);
@@ -175,7 +184,10 @@ public class PatternLayoutTest {
     @Test
     public void testUnixTime() throws Exception {
         final LoggerContext ctx = (LoggerContext) LogManager.getContext();
-        final PatternLayout layout =
PatternLayout.createCustomLayout("%d{UNIX} %m", ctx.getConfiguration());
+        final PatternLayout layout = PatternLayout.custom()
+            .withPattern("%d{UNIX} %m")
+            .withConfiguration(ctx.getConfiguration())
+            .build();
         final LogEvent event1 = new
Log4jLogEvent(this.getClass().getName(), null,
                 "org.apache.logging.log4j.core.Logger", Level.INFO, new
SimpleMessage("Hello, world 1!"), null);
         final byte[] result1 = layout.toByteArray(event1);
@@ -191,7 +203,10 @@ public class PatternLayoutTest {
     @Test
     public void testUnixTimeMillis() throws Exception {
         final LoggerContext ctx = (LoggerContext) LogManager.getContext();
-        final PatternLayout layout =
PatternLayout.createCustomLayout("%d{UNIX_MILLIS} %m",
ctx.getConfiguration());
+        final PatternLayout layout = PatternLayout.custom()
+            .withPattern("%d{UNIX_MILLIS} %m")
+            .withConfiguration(ctx.getConfiguration())
+            .build();
         final LogEvent event1 = new
Log4jLogEvent(this.getClass().getName(), null,
                 "org.apache.logging.log4j.core.Logger", Level.INFO, new
SimpleMessage("Hello, world 1!"), null);
         final byte[] result1 = layout.toByteArray(event1);
@@ -207,8 +222,12 @@ public class PatternLayoutTest {
     @Test
     public void testHeaderFooter() throws Exception {
         final LoggerContext ctx = (LoggerContext) LogManager.getContext();
-        final PatternLayout layout = PatternLayout
-            .createLayout("%d{UNIX} %m", ctx.getConfiguration(), null,
null, true, false, "${ctx:header}", "${ctx:footer}");
+        final PatternLayout layout = PatternLayout.custom()
+            .withPattern("%d{UNIX} %m")
+            .withConfiguration(ctx.getConfiguration())
+            .withHeader("${ctx:header}")
+            .withFooter("${ctx:footer}")
+            .build();
         ThreadContext.put("header", "Hello world Header");
         ThreadContext.put("footer", "Hello world Footer");
         final LogEvent event1 = new
Log4jLogEvent(this.getClass().getName(), null,

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsQueueTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsQueueTest.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsQueueTest.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsQueueTest.java
Mon May 26 00:23:30 2014
@@ -100,7 +100,7 @@ public class JmsQueueTest {
         final CompositeFilter serverFilters =
CompositeFilter.createFilters(new Filter[]{serverFilter});
         final ListAppender listApp = new ListAppender("Events",
serverFilters, null, false, false);
         listApp.start();
-        final PatternLayout layout = PatternLayout.createCustomLayout("%m
%ex%n");
+        final PatternLayout layout =
PatternLayout.custom().withPattern("%m %ex%n").build();
         final ConsoleAppender console =
ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console",
"false", "true");
         console.start();
         final Logger serverLogger =
ctx.getLogger(JmsTopicReceiver.class.getName());

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsTopicTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsTopicTest.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsTopicTest.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/jms/JmsTopicTest.java
Mon May 26 00:23:30 2014
@@ -100,7 +100,7 @@ public class JmsTopicTest {
         final CompositeFilter serverFilters =
CompositeFilter.createFilters(new Filter[]{serverFilter});
         final ListAppender listApp = new ListAppender("Events",
serverFilters, null, false, false);
         listApp.start();
-        final PatternLayout layout = PatternLayout.createCustomLayout("%m
%ex%n");
+        final PatternLayout layout =
PatternLayout.custom().withPattern("%m %ex%n").build();
         final ConsoleAppender console =
                 ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT",
"Console", "false", "true");
         console.start();

Modified:
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java?rev=1597494&r1=1597493&r2=1597494&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java
Mon May 26 00:23:30 2014
@@ -173,7 +173,7 @@ public abstract class AbstractSocketServ
         socketAppender.start();
         final ListAppender listAppender = new ListAppender("Events",
serverFilter, null, false, false);
         listAppender.start();
-        final PatternLayout layout = PatternLayout.createCustomLayout("%m
%ex%n");
+        final PatternLayout layout =
PatternLayout.custom().withPattern("%m %ex%n").build();
         final ConsoleAppender console =
ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console",
"false",
                 "true");
         final Logger serverLogger =
ctx.getLogger(this.getClass().getName());





-- 
Matt Sicker <boards@gmail.com>

Mime
View raw message