You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2016/08/21 08:41:51 UTC

[01/24] logging-log4j2 git commit: LOG4J2-1516 moved putAll(Map) method into separate ThreadContextMap2 interface

Repository: logging-log4j2
Updated Branches:
  refs/heads/LOG4J2-1528 7a1cd3a38 -> ce08bfbe4


LOG4J2-1516 moved putAll(Map) method into separate ThreadContextMap2 interface


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

Branch: refs/heads/LOG4J2-1528
Commit: 6a23301660830fcd4728b1b952b607a9e1e26f65
Parents: 60649ef
Author: rpopma <rp...@apache.org>
Authored: Sat Aug 20 09:00:38 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Aug 20 09:00:38 2016 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/ThreadContext.java | 55 +++++++++++---------
 .../log4j/spi/DefaultThreadContextMap.java      |  6 +--
 .../logging/log4j/spi/ThreadContextMap.java     | 13 +----
 .../logging/log4j/spi/ThreadContextMap2.java    | 40 ++++++++++++++
 .../org/apache/logging/slf4j/MDCContextMap.java |  7 +--
 src/changes/changes.xml                         |  4 +-
 6 files changed, 81 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6a233016/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java b/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
index cea2e8d..c932746 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
@@ -31,6 +31,7 @@ import org.apache.logging.log4j.spi.DefaultThreadContextMap;
 import org.apache.logging.log4j.spi.DefaultThreadContextStack;
 import org.apache.logging.log4j.spi.Provider;
 import org.apache.logging.log4j.spi.ThreadContextMap;
+import org.apache.logging.log4j.spi.ThreadContextMap2;
 import org.apache.logging.log4j.spi.ThreadContextStack;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.PropertiesUtil;
@@ -149,7 +150,7 @@ public final class ThreadContext {
 
     /**
      * An empty iterator. Since Java 1.7 added the Collections.emptyIterator() method, we have to make do.
-     * 
+     *
      * @param <E> the type of the empty iterator
      */
     private static class EmptyIterator<E> implements Iterator<E> {
@@ -260,7 +261,7 @@ public final class ThreadContext {
      * <p>
      * If the current thread does not have a context map it is created as a side effect.
      * </p>
-     * 
+     *
      * @param key The key name.
      * @param value The key value.
      */
@@ -278,7 +279,13 @@ public final class ThreadContext {
      * @since 2.7
      */
     public static void putAll(final Map<String, String> m) {
-        contextMap.putAll(m);
+        if (contextMap instanceof ThreadContextMap2) {
+            ((ThreadContextMap2) contextMap).putAll(m);
+        } else {
+            for (final Map.Entry<String, String> entry: m.entrySet()) {
+                contextMap.put(entry.getKey(), entry.getValue());
+            }
+        }
     }
 
     /**
@@ -287,7 +294,7 @@ public final class ThreadContext {
      * <p>
      * This method has no side effects.
      * </p>
-     * 
+     *
      * @param key The key to locate.
      * @return The value associated with the key or null.
      */
@@ -297,7 +304,7 @@ public final class ThreadContext {
 
     /**
      * Removes the context value identified by the <code>key</code> parameter.
-     * 
+     *
      * @param key The key to remove.
      */
     public static void remove(final String key) {
@@ -321,7 +328,7 @@ public final class ThreadContext {
 
     /**
      * Determines if the key is in the context.
-     * 
+     *
      * @param key The key to locate.
      * @return True if the key is in the context, false otherwise.
      */
@@ -331,7 +338,7 @@ public final class ThreadContext {
 
     /**
      * Returns a mutable copy of current thread's context Map.
-     * 
+     *
      * @return a mutable copy of the context.
      */
     public static Map<String, String> getContext() {
@@ -340,7 +347,7 @@ public final class ThreadContext {
 
     /**
      * Returns an immutable view of the current thread's context Map.
-     * 
+     *
      * @return An immutable view of the ThreadContext Map.
      */
     public static Map<String, String> getImmutableContext() {
@@ -350,7 +357,7 @@ public final class ThreadContext {
 
     /**
      * Returns true if the Map is empty.
-     * 
+     *
      * @return true if the Map is empty, false otherwise.
      */
     public static boolean isEmpty() {
@@ -366,7 +373,7 @@ public final class ThreadContext {
 
     /**
      * Returns a copy of this thread's stack.
-     * 
+     *
      * @return A copy of this thread's stack.
      */
     public static ContextStack cloneStack() {
@@ -375,7 +382,7 @@ public final class ThreadContext {
 
     /**
      * Gets an immutable copy of this current thread's context stack.
-     * 
+     *
      * @return an immutable copy of the ThreadContext stack.
      */
     public static ContextStack getImmutableStack() {
@@ -385,7 +392,7 @@ public final class ThreadContext {
 
     /**
      * Sets this thread's stack.
-     * 
+     *
      * @param stack The stack to use.
      */
     public static void setStack(final Collection<String> stack) {
@@ -398,7 +405,7 @@ public final class ThreadContext {
 
     /**
      * Gets the current nesting depth of this thread's stack.
-     * 
+     *
      * @return the number of items in the stack.
      *
      * @see #trim
@@ -498,13 +505,13 @@ public final class ThreadContext {
      * <p>
      * For example, the combination
      * </p>
-     * 
+     *
      * <pre>
      * void foo() {
      *     final int depth = ThreadContext.getDepth();
-     * 
+     *
      *     // ... complex sequence of calls
-     * 
+     *
      *     ThreadContext.trim(depth);
      * }
      * </pre>
@@ -527,7 +534,7 @@ public final class ThreadContext {
 
         /**
          * Returns the element at the top of the stack.
-         * 
+         *
          * @return The element at the top of the stack.
          * @throws java.util.NoSuchElementException if the stack is empty.
          */
@@ -535,42 +542,42 @@ public final class ThreadContext {
 
         /**
          * Returns the element at the top of the stack without removing it or null if the stack is empty.
-         * 
+         *
          * @return the element at the top of the stack or null if the stack is empty.
          */
         String peek();
 
         /**
          * Pushes an element onto the stack.
-         * 
+         *
          * @param message The element to add.
          */
         void push(String message);
 
         /**
          * Returns the number of elements in the stack.
-         * 
+         *
          * @return the number of elements in the stack.
          */
         int getDepth();
 
         /**
          * Returns all the elements in the stack in a List.
-         * 
+         *
          * @return all the elements in the stack in a List.
          */
         List<String> asList();
 
         /**
          * Trims elements from the end of the stack.
-         * 
+         *
          * @param depth The maximum number of items in the stack to keep.
          */
         void trim(int depth);
 
         /**
          * Returns a copy of the ContextStack.
-         * 
+         *
          * @return a copy of the ContextStack.
          */
         ContextStack copy();
@@ -578,7 +585,7 @@ public final class ThreadContext {
         /**
          * Returns a ContextStack with the same contents as this ContextStack or {@code null}. Attempts to modify the
          * returned stack may or may not throw an exception, but will not affect the contents of this ContextStack.
-         * 
+         *
          * @return a ContextStack with the same contents as this ContextStack or {@code null}.
          */
         ContextStack getImmutableStackOrNull();

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6a233016/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
index 0acf47d..a45ece5 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
@@ -28,8 +28,8 @@ import org.apache.logging.log4j.util.PropertiesUtil;
  * expected that the Map will be passed to many more log events than the number of keys it contains the performance
  * should be much better than if the Map was copied for each event.
  */
-public class DefaultThreadContextMap implements ThreadContextMap {
-    
+public class DefaultThreadContextMap implements ThreadContextMap, ThreadContextMap2 {
+
     /**
      * Property name ({@value} ) for selecting {@code InheritableThreadLocal} (value "true") or plain
      * {@code ThreadLocal} (value is not "true") in the implementation.
@@ -86,7 +86,7 @@ public class DefaultThreadContextMap implements ThreadContextMap {
         }
         localMap.set(Collections.unmodifiableMap(map));
     }
-    
+
     @Override
     public String get(final String key) {
         final Map<String, String> map = localMap.get();

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6a233016/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap.java
index 0b31d37..f0b2df4 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap.java
@@ -22,7 +22,7 @@ import java.util.Map;
  * Service provider interface to implement custom MDC behavior for {@link org.apache.logging.log4j.ThreadContext}.
  */
 public interface ThreadContextMap {
-    
+
     /**
      * Clears the context.
      */
@@ -75,17 +75,6 @@ public interface ThreadContextMap {
     void put(final String key, final String value);
 
     /**
-     * Puts all given context map entries into the current thread's
-     * context map.
-     *
-     * <p>If the current thread does not have a context map it is
-     * created as a side effect.</p>
-     * @param m The map.
-     * @since 2.7
-     */
-    public void putAll(final Map<String, String> m);
-
-    /**
      * Removes the the context identified by the <code>key</code>
      * parameter.
      * @param key The key to remove.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6a233016/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
new file mode 100644
index 0000000..7eba48d
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
@@ -0,0 +1,40 @@
+/*
+ * 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.spi;
+
+import java.util.Map;
+
+/**
+ * Extension service provider interface to implement additional custom MDC behavior for
+ * {@link org.apache.logging.log4j.ThreadContext}.
+ *
+ * @see ThreadContextMap
+ * @since 2.7
+ */
+public interface ThreadContextMap2 {
+
+    /**
+     * Puts all given context map entries into the current thread's
+     * context map.
+     *
+     * <p>If the current thread does not have a context map it is
+     * created as a side effect.</p>
+     * @param map The map.
+     * @since 2.7
+     */
+    void putAll(final Map<String, String> map);
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6a233016/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
----------------------------------------------------------------------
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
index b5c640f..9b0251a 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
@@ -20,13 +20,14 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.logging.log4j.spi.ThreadContextMap;
+import org.apache.logging.log4j.spi.ThreadContextMap2;
 import org.slf4j.MDC;
 
 /**
  * Bind the ThreadContextMap to the SLF4J MDC.
  */
-public class MDCContextMap implements ThreadContextMap {
-	
+public class MDCContextMap implements ThreadContextMap, ThreadContextMap2 {
+
     @Override
     public void put(final String key, final String value) {
         MDC.put(key, value);
@@ -35,7 +36,7 @@ public class MDCContextMap implements ThreadContextMap {
     @Override
     public void putAll(final Map<String, String> m) {
     	for (Entry<String, String> entry : m.entrySet()) {
-            MDC.put(entry.getKey(), entry.getValue());			
+            MDC.put(entry.getKey(), entry.getValue());
 		}
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6a233016/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 675a24a..be283c7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -87,8 +87,8 @@
       <action issue="LOG4J2-1508" dev="ggregory" type="add" due-to="Gary Gregory">
         Allow a Builder to subclass another Builder.
       </action>
-      <action issue="LOG4J2-1516" dev="ggregory" type="add" due-to="Gary Gregory">
-        Add ThreadContextMap.putAll(Map&lt;String, String&gt;).
+      <action issue="LOG4J2-1516" dev="rpopma" type="add" due-to="Gary Gregory">
+        Add ThreadContextMap2 interface supporting method putAll(Map&lt;String, String&gt;).
       </action>
       <action issue="LOG4J2-1519" dev="ggregory" type="add" due-to="Gary Gregory">
         Add ThreadContext.putAll(Map&lt;String, String&gt;).


[13/24] logging-log4j2 git commit: Refactor thread factories.

Posted by mi...@apache.org.
Refactor thread factories.

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

Branch: refs/heads/LOG4J2-1528
Commit: 9afe7ea8544942a6ddea68fbdce4428473d07a06
Parents: 932824a
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 11:47:08 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 11:47:08 2016 -0700

----------------------------------------------------------------------
 .../core/async/AsyncLoggerConfigDisruptor.java  |   3 +-
 .../log4j/core/async/AsyncLoggerDisruptor.java  |   3 +-
 .../log4j/core/async/DaemonThreadFactory.java   |  51 -------
 .../core/config/ConfigurationScheduler.java     |  15 +-
 .../apache/logging/log4j/core/jmx/Server.java   |   7 +-
 .../logging/log4j/core/util/Log4jThread.java    | 138 +++++++++----------
 .../log4j/core/util/Log4jThreadFactory.java     |  90 ++++++++++++
 .../flume/appender/FlumePersistentManager.java  |  30 +---
 8 files changed, 177 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9afe7ea8/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java
index d0c9eea..f3565a1 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java
@@ -28,6 +28,7 @@ import org.apache.logging.log4j.core.impl.LogEventFactory;
 import org.apache.logging.log4j.core.impl.MutableLogEvent;
 import org.apache.logging.log4j.core.impl.ReusableLogEventFactory;
 import org.apache.logging.log4j.core.jmx.RingBufferAdmin;
+import org.apache.logging.log4j.core.util.Log4jThreadFactory;
 import org.apache.logging.log4j.message.ReusableMessage;
 import org.apache.logging.log4j.status.StatusLogger;
 
@@ -176,7 +177,7 @@ public class AsyncLoggerConfigDisruptor implements AsyncLoggerConfigDelegate {
         }
     };
 
-    private static final ThreadFactory THREAD_FACTORY = new DaemonThreadFactory("AsyncLoggerConfig-");
+    private static final ThreadFactory THREAD_FACTORY = Log4jThreadFactory.createDaemonThreadFactory("AsyncLoggerConfig");
 
     private int ringBufferSize;
     private AsyncQueueFullPolicy asyncQueueFullPolicy;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9afe7ea8/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
index 1875ad2..259e22d 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
@@ -22,6 +22,7 @@ import java.util.concurrent.Executors;
 
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.jmx.RingBufferAdmin;
+import org.apache.logging.log4j.core.util.Log4jThreadFactory;
 import org.apache.logging.log4j.status.StatusLogger;
 
 import com.lmax.disruptor.ExceptionHandler;
@@ -81,7 +82,7 @@ class AsyncLoggerDisruptor {
         LOGGER.trace("[{}] AsyncLoggerDisruptor creating new disruptor for this context.", contextName);
         ringBufferSize = DisruptorUtil.calculateRingBufferSize("AsyncLogger.RingBufferSize");
         final WaitStrategy waitStrategy = DisruptorUtil.createWaitStrategy("AsyncLogger.WaitStrategy");
-        executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory("AsyncLogger[" + contextName + "]-"));
+        executor = Executors.newSingleThreadExecutor(Log4jThreadFactory.createDaemonThreadFactory("AsyncLogger[" + contextName + "]"));
         backgroundThreadId = DisruptorUtil.getExecutorThreadId(executor);
         asyncQueueFullPolicy = AsyncQueueFullPolicyFactory.create();
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9afe7ea8/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
deleted file mode 100644
index 3267c61..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.async;
-
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.logging.log4j.core.util.Log4jThread;
-
-/**
- * ThreadFactory that creates daemon threads for the async loggers.
- */
-public class DaemonThreadFactory implements ThreadFactory {
-
-    private static final AtomicInteger THREAD_NUMBER = new AtomicInteger(1);
-    private final ThreadGroup group;
-    private final String threadNamePrefix;
-
-    public DaemonThreadFactory(final String threadNamePrefix) {
-        this.threadNamePrefix = threadNamePrefix;
-        final SecurityManager securityManager = System.getSecurityManager();
-        group = securityManager != null ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
-    }
-
-    @Override
-    public Thread newThread(final Runnable runnable) {
-        final Thread thread = new Log4jThread(group, runnable, threadNamePrefix + THREAD_NUMBER.getAndIncrement(), 0);
-        if (!thread.isDaemon()) {
-            thread.setDaemon(true);
-        }
-        if (thread.getPriority() != Thread.NORM_PRIORITY) {
-            thread.setPriority(Thread.NORM_PRIORITY);
-        }
-        return thread;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9afe7ea8/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java
index 6a3c1ec..744ed24 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java
@@ -16,12 +16,6 @@
  */
 package org.apache.logging.log4j.core.config;
 
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.AbstractLifeCycle;
-import org.apache.logging.log4j.core.async.DaemonThreadFactory;
-import org.apache.logging.log4j.core.util.CronExpression;
-import org.apache.logging.log4j.status.StatusLogger;
-
 import java.util.Date;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ScheduledExecutorService;
@@ -29,6 +23,12 @@ import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.AbstractLifeCycle;
+import org.apache.logging.log4j.core.util.CronExpression;
+import org.apache.logging.log4j.core.util.Log4jThreadFactory;
+import org.apache.logging.log4j.status.StatusLogger;
+
 /**
  *
  */
@@ -48,7 +48,8 @@ public class ConfigurationScheduler extends AbstractLifeCycle {
             if (scheduledItems > 5) {
                 scheduledItems = 5;
             }
-            executorService = new ScheduledThreadPoolExecutor(scheduledItems, new DaemonThreadFactory("Log4j2Scheduled-"));
+            executorService = new ScheduledThreadPoolExecutor(scheduledItems,
+                    Log4jThreadFactory.createDaemonThreadFactory("Log4j2Scheduled"));
         } else {
             LOGGER.debug("No scheduled items");
         }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9afe7ea8/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
index fd14e11..10f343a 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
@@ -36,11 +36,11 @@ import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.appender.AsyncAppender;
 import org.apache.logging.log4j.core.async.AsyncLoggerConfig;
 import org.apache.logging.log4j.core.async.AsyncLoggerContext;
-import org.apache.logging.log4j.core.async.DaemonThreadFactory;
 import org.apache.logging.log4j.core.config.LoggerConfig;
 import org.apache.logging.log4j.core.impl.Log4jContextFactory;
 import org.apache.logging.log4j.core.selector.ContextSelector;
 import org.apache.logging.log4j.core.util.Constants;
+import org.apache.logging.log4j.core.util.Log4jThreadFactory;
 import org.apache.logging.log4j.spi.LoggerContextFactory;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.PropertiesUtil;
@@ -59,7 +59,7 @@ public final class Server {
     public static final String DOMAIN = "org.apache.logging.log4j2";
     private static final String PROPERTY_DISABLE_JMX = "log4j2.disable.jmx";
     private static final String PROPERTY_ASYNC_NOTIF = "log4j2.jmx.notify.async";
-    private static final String THREAD_NAME_PREFIX = "log4j2.jmx.notif-";
+    private static final String THREAD_NAME_PREFIX = "log4j2.jmx.notif";
     private static final StatusLogger LOGGER = StatusLogger.getLogger();
     static final Executor executor = isJmxDisabled() ? null : createExecutor();
 
@@ -76,7 +76,8 @@ public final class Server {
     private static ExecutorService createExecutor() {
         final boolean defaultAsync = !Constants.IS_WEB_APP;
         final boolean async = PropertiesUtil.getProperties().getBooleanProperty(PROPERTY_ASYNC_NOTIF, defaultAsync);
-        return async ? Executors.newFixedThreadPool(1, new DaemonThreadFactory(THREAD_NAME_PREFIX)) : null;
+        return async ? Executors.newFixedThreadPool(1, Log4jThreadFactory.createDaemonThreadFactory(THREAD_NAME_PREFIX))
+                : null;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9afe7ea8/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThread.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThread.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThread.java
index 1467a54..b92f181 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThread.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThread.java
@@ -1,69 +1,69 @@
-/*
- * 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.util;
-
-/**
- * Prefixes thread names with {@code "Log4j2-"}.
- */
-public class Log4jThread extends Thread {
-
-    private static final String PREFIX = "Log4j2-";
-
-    private static int threadInitNumber;
-
-    private static synchronized int nextThreadNum() {
-        return threadInitNumber++;
-    }
-
-    private static String toThreadName(final Object name) {
-        return PREFIX + name;
-    }
-
-    public Log4jThread() {
-        super(toThreadName(nextThreadNum()));
-    }
-
-    public Log4jThread(final Runnable target) {
-        super(target, toThreadName(nextThreadNum()));
-    }
-
-    public Log4jThread(final Runnable target, final String name) {
-        super(target, toThreadName(name));
-    }
-
-    public Log4jThread(final String name) {
-        super(toThreadName(name));
-    }
-
-    public Log4jThread(final ThreadGroup group, final Runnable target) {
-        super(group, target, toThreadName(nextThreadNum()));
-    }
-
-    public Log4jThread(final ThreadGroup group, final Runnable target, final String name) {
-        super(group, target, toThreadName(name));
-    }
-
-    public Log4jThread(final ThreadGroup group, final Runnable target, final String name, final long stackSize) {
-        super(group, target, toThreadName(name), stackSize);
-    }
-
-    public Log4jThread(final ThreadGroup group, final String name) {
-        super(group, toThreadName(name));
-    }
-
-}
+/*
+ * 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.util;
+
+/**
+ * Prefixes thread names with {@code "Log4j2-"}.
+ */
+public class Log4jThread extends Thread {
+
+    static final String PREFIX = "Log4j2-";
+
+    private static int threadInitNumber;
+
+    private static synchronized int nextThreadNum() {
+        return threadInitNumber++;
+    }
+
+    private static String toThreadName(final Object name) {
+        return PREFIX + name;
+    }
+
+    public Log4jThread() {
+        super(toThreadName(nextThreadNum()));
+    }
+
+    public Log4jThread(final Runnable target) {
+        super(target, toThreadName(nextThreadNum()));
+    }
+
+    public Log4jThread(final Runnable target, final String name) {
+        super(target, toThreadName(name));
+    }
+
+    public Log4jThread(final String name) {
+        super(toThreadName(name));
+    }
+
+    public Log4jThread(final ThreadGroup group, final Runnable target) {
+        super(group, target, toThreadName(nextThreadNum()));
+    }
+
+    public Log4jThread(final ThreadGroup group, final Runnable target, final String name) {
+        super(group, target, toThreadName(name));
+    }
+
+    public Log4jThread(final ThreadGroup group, final Runnable target, final String name, final long stackSize) {
+        super(group, target, toThreadName(name), stackSize);
+    }
+
+    public Log4jThread(final ThreadGroup group, final String name) {
+        super(group, toThreadName(name));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9afe7ea8/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java
new file mode 100644
index 0000000..ed07056
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java
@@ -0,0 +1,90 @@
+/*
+ * 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.util;
+
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.logging.log4j.util.Strings;
+
+/**
+ * Creates {@link Log4jThreads}.
+ * 
+ * @since 2.7
+ */
+public class Log4jThreadFactory implements ThreadFactory {
+
+    private static final String PREFIX = Log4jThread.PREFIX + "TF-";
+
+    /**
+     * Creates a new daemon thread factory.
+     * 
+     * @param threadNamePrefix
+     *            The thread name prefix.
+     * @return a new daemon thread factory.
+     */
+    public static Log4jThreadFactory createDaemonThreadFactory(final String threadNamePrefix) {
+        return new Log4jThreadFactory(threadNamePrefix, true, Thread.NORM_PRIORITY);
+    }
+
+    private static final AtomicInteger FACTORY_NUMBER = new AtomicInteger(1);
+    private static final AtomicInteger THREAD_NUMBER = new AtomicInteger(1);
+    private final boolean daemon;
+    private final ThreadGroup group;
+    private final int priority;
+    private final String threadNamePrefix;
+
+    /**
+     * Constructs a thread factory with default settings.
+     */
+    public Log4jThreadFactory() {
+        this("thread", false, Thread.NORM_PRIORITY);
+    }
+
+    /**
+     * Constructs an initialized thread factory.
+     * 
+     * @param threadNamePrefix
+     *            The thread name prefix.
+     * @param daemon
+     *            Whether to create daemon threads.
+     * @param priority
+     *            The thread priority.
+     */
+    public Log4jThreadFactory(final String threadNamePrefix, final boolean daemon, final int priority) {
+        this.threadNamePrefix = PREFIX + FACTORY_NUMBER.getAndIncrement() + "-" + threadNamePrefix + "-";
+        this.daemon = daemon;
+        this.priority = priority;
+        final SecurityManager securityManager = System.getSecurityManager();
+        this.group = securityManager != null ? securityManager.getThreadGroup()
+                : Thread.currentThread().getThreadGroup();
+    }
+
+    @Override
+    public Thread newThread(final Runnable runnable) {
+        final Thread thread = new Log4jThread(group, runnable, threadNamePrefix + THREAD_NUMBER.getAndIncrement(), 0);
+        if (thread.isDaemon() != daemon) {
+            thread.setDaemon(daemon);
+        }
+        if (thread.getPriority() != priority) {
+            thread.setPriority(priority);
+        }
+        return thread;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9afe7ea8/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java
----------------------------------------------------------------------
diff --git a/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java b/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java
index daf6fdd..a76065a 100644
--- a/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java
+++ b/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java
@@ -46,6 +46,7 @@ import org.apache.logging.log4j.core.config.plugins.util.PluginManager;
 import org.apache.logging.log4j.core.config.plugins.util.PluginType;
 import org.apache.logging.log4j.core.util.FileUtils;
 import org.apache.logging.log4j.core.util.Log4jThread;
+import org.apache.logging.log4j.core.util.Log4jThreadFactory;
 import org.apache.logging.log4j.core.util.SecretKeyProvider;
 import org.apache.logging.log4j.util.Strings;
 
@@ -124,7 +125,7 @@ public class FlumePersistentManager extends FlumeAvroManager {
             lockTimeoutRetryCount);
         this.worker.start();
         this.secretKey = secretKey;
-        this.threadPool = Executors.newCachedThreadPool(new DaemonThreadFactory());
+        this.threadPool = Executors.newCachedThreadPool(Log4jThreadFactory.createDaemonThreadFactory("Flume"));
         this.lockTimeoutRetryCount = lockTimeoutRetryCount;
     }
 
@@ -824,33 +825,6 @@ public class FlumePersistentManager extends FlumeAvroManager {
     }
 
     /**
-     * Factory that creates Daemon threads that can be properly shut down.
-     */
-    private static class DaemonThreadFactory implements ThreadFactory {
-        private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1);
-        private final ThreadGroup group;
-        private final AtomicInteger threadNumber = new AtomicInteger(1);
-        private final String namePrefix;
-
-        public DaemonThreadFactory() {
-            final SecurityManager securityManager = System.getSecurityManager();
-            group = securityManager != null ? securityManager.getThreadGroup() :
-                Thread.currentThread().getThreadGroup();
-            namePrefix = "DaemonPool-" + POOL_NUMBER.getAndIncrement() + "-thread-";
-        }
-
-        @Override
-        public Thread newThread(final Runnable r) {
-            final Thread thread = new Log4jThread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
-            thread.setDaemon(true);
-            if (thread.getPriority() != Thread.NORM_PRIORITY) {
-                thread.setPriority(Thread.NORM_PRIORITY);
-            }
-            return thread;
-        }
-    }
-
-    /**
      * An internal class.
      */
     private static class Gate {


[12/24] logging-log4j2 git commit: Fix TTCC constant

Posted by mi...@apache.org.
Fix TTCC constant


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

Branch: refs/heads/LOG4J2-1528
Commit: 5aac1af72d826b654f6e4f4b80cb65f90f39458d
Parents: 932824a
Author: Mikael St�ldal <mi...@staldal.nu>
Authored: Sat Aug 20 20:29:53 2016 +0200
Committer: Mikael St�ldal <mi...@staldal.nu>
Committed: Sat Aug 20 20:29:53 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/core/layout/PatternLayout.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5aac1af7/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 4f77649..2c235f4 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
@@ -64,9 +64,9 @@ public final class PatternLayout extends AbstractStringLayout {
     public static final String DEFAULT_CONVERSION_PATTERN = "%m%n";
 
     /**
-     * A conversion pattern equivalent to the TTCCCLayout. Current value is <b>%r [%t] %p %c %x - %m%n</b>.
+     * A conversion pattern equivalent to the TTCCLayout. Current value is <b>%r [%t] %p %c %notEmpty{%x }- %m%n</b>.
      */
-    public static final String TTCC_CONVERSION_PATTERN = "%r [%t] %p %c %x - %m%n";
+    public static final String TTCC_CONVERSION_PATTERN = "%r [%t] %p %c %notEmpty{%x }- %m%n";
 
     /**
      * A simple pattern. Current value is <b>%d [%t] %p %c - %m%n</b>.


[22/24] logging-log4j2 git commit: [OG4J2-1501] FileAppender should be able to create files on-demand. Keep in AB order.

Posted by mi...@apache.org.
[OG4J2-1501] FileAppender should be able to create files on-demand. Keep
in AB order.

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

Branch: refs/heads/LOG4J2-1528
Commit: 03fe13f26ad8a315aabc56bce3e953783d988050
Parents: 2f34ba3
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 22:31:45 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 22:31:45 2016 -0700

----------------------------------------------------------------------
 src/site/xdoc/manual/appenders.xml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/03fe13f2/src/site/xdoc/manual/appenders.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/appenders.xml b/src/site/xdoc/manual/appenders.xml
index 5df7d99..0a38f0b 100644
--- a/src/site/xdoc/manual/appenders.xml
+++ b/src/site/xdoc/manual/appenders.xml
@@ -353,6 +353,12 @@
               <td>When bufferedIO is true, this is the buffer size, the default is 8192 bytes.</td>
             </tr>
             <tr>
+              <td>createOnDemand</td>
+              <td>boolean</td>
+              <td>The appender creates the file on-demand. The appender only creates the file when a log event 
+                passes all filters and is routed to this appender.</td>
+            </tr>
+            <tr>
               <td>filter</td>
               <td>Filter</td>
               <td>A Filter to determine if the event should be handled by this Appender. More than one Filter
@@ -384,12 +390,6 @@
                 of "%m%n" will be used.</td>
             </tr>
             <tr>
-              <td>createOnDemand</td>
-              <td>boolean</td>
-              <td>The appender creates the file on-demand. The appender only creates the file when a log event 
-                passes all filters and is routed to this appender.</td>
-            </tr>
-            <tr>
               <td>locking</td>
               <td>boolean</td>
               <td>When set to true, I/O operations will occur only while the file lock is held allowing FileAppenders


[08/24] logging-log4j2 git commit: Format: Longer lines.

Posted by mi...@apache.org.
Format: Longer lines.

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

Branch: refs/heads/LOG4J2-1528
Commit: 921b330cc5660a902003d601c0bcdf7e9faf5aa5
Parents: 1f23297
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Aug 19 18:14:10 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Aug 19 18:14:10 2016 -0700

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/async/DaemonThreadFactory.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/921b330c/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
index 90a15e0..3267c61 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
@@ -38,8 +38,7 @@ public class DaemonThreadFactory implements ThreadFactory {
 
     @Override
     public Thread newThread(final Runnable runnable) {
-        final Thread thread = new Log4jThread(group, runnable, threadNamePrefix
-                + THREAD_NUMBER.getAndIncrement(), 0);
+        final Thread thread = new Log4jThread(group, runnable, threadNamePrefix + THREAD_NUMBER.getAndIncrement(), 0);
         if (!thread.isDaemon()) {
             thread.setDaemon(true);
         }


[04/24] logging-log4j2 git commit: LOG4J2-1527 Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications.

Posted by mi...@apache.org.
LOG4J2-1527 Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications.

This closes #39 (https://github.com/apache/logging-log4j2/pull/39 )


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

Branch: refs/heads/LOG4J2-1528
Commit: 147f78c45e181d78778a710d24510c9b03d97bc7
Parents: 6a23301
Author: rpopma <rp...@apache.org>
Authored: Sat Aug 20 09:44:20 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Aug 20 09:44:20 2016 +0900

----------------------------------------------------------------------
 .../log4j/core/async/RingBufferLogEvent.java      |  4 +++-
 .../log4j/core/async/RingBufferLogEventTest.java  | 18 ++++++++++++++----
 src/changes/changes.xml                           |  4 ++++
 3 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/147f78c4/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
index c4de9d4..76b00a1 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
@@ -210,7 +210,9 @@ public class RingBufferLogEvent implements LogEvent, ReusableMessage, CharSequen
      */
     @Override
     public String getFormattedMessage() {
-        return messageText.toString();
+        return messageText != null // LOG4J2-1527: may be null in web apps
+                ? messageText.toString() // note: please keep below "redundant" braces for readability
+                : (message == null ? null : message.getFormattedMessage());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/147f78c4/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java
index ec3a874..5c7f467 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java
@@ -121,11 +121,11 @@ public class RingBufferLogEventTest {
         final long nanoTime = 1;
         evt.setValues(null, loggerName, marker, fqcn, level, data, t, map,
                 contextStack, -1, threadName, -1, location, currentTimeMillis, nanoTime);
-        
+
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         final ObjectOutputStream out = new ObjectOutputStream(baos);
         out.writeObject(evt);
-        
+
         final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
         final RingBufferLogEvent other = (RingBufferLogEvent) in.readObject();
         assertEquals(loggerName, other.getLoggerName());
@@ -141,7 +141,7 @@ public class RingBufferLogEventTest {
         assertEquals(location, other.getSource());
         assertEquals(currentTimeMillis, other.getTimeMillis());
     }
-    
+
     @Test
     public void testCreateMementoReturnsCopy() {
         final RingBufferLogEvent evt = new RingBufferLogEvent();
@@ -160,7 +160,7 @@ public class RingBufferLogEventTest {
         final long nanoTime = 1;
         evt.setValues(null, loggerName, marker, fqcn, level, data, t, map,
                 contextStack, -1, threadName, -1, location, currentTimeMillis, nanoTime);
-        
+
         final LogEvent actual = evt.createMemento();
         assertEquals(evt.getLoggerName(), actual.getLoggerName());
         assertEquals(evt.getMarker(), actual.getMarker());
@@ -175,4 +175,14 @@ public class RingBufferLogEventTest {
         assertEquals(evt.getSource(), actual.getSource());
         assertEquals(evt.getThrownProxy(), actual.getThrownProxy());
     }
+
+    @Test
+    public void testMessageTextNeverThrowsNpe() {
+        final RingBufferLogEvent evt = new RingBufferLogEvent();
+        try {
+            evt.getFormattedMessage();
+        } catch (NullPointerException e) {
+            fail("the messageText field was not set");
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/147f78c4/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index be283c7..1ea373c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,10 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+
+      <action issue="LOG4J2-1527" dev="rpopma" type="fix" due-to="Jose Leon">
+        Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications.
+      </action>
       <action issue="LOG4J2-905" dev="ggregory" type="fix" due-to="Gary Gregory, Moritz L�ser">
         Ability to disable (date) lookup completely, compatibility issues with other libraries like Camel.
       </action>


[11/24] logging-log4j2 git commit: Document empty block.

Posted by mi...@apache.org.
Document empty block.

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

Branch: refs/heads/LOG4J2-1528
Commit: 932824ad608ebdfd4dcd2725c80fb5c82f3d8120
Parents: dbe8c3a
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 10:09:27 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 10:09:27 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/logging/log4j/spi/ThreadContextStack.java  | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/932824ad/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java
index 8ebf5d9..04d2ece 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java
@@ -22,4 +22,5 @@ import org.apache.logging.log4j.ThreadContext;
  * Service provider interface to implement custom NDC behavior for {@link ThreadContext}.
  */
 public interface ThreadContextStack extends ThreadContext.ContextStack {
+    // empty
 }


[02/24] logging-log4j2 git commit: [LOG4J2-1504] RollingFileAppender should be able to create files on-demand.

Posted by mi...@apache.org.
[LOG4J2-1504] RollingFileAppender should be able to create files
on-demand.

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

Branch: refs/heads/LOG4J2-1528
Commit: a82794f06e3bc095ef0bca41b98c5d1ea915de76
Parents: 60649ef
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Aug 19 17:27:26 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Aug 19 17:27:26 2016 -0700

----------------------------------------------------------------------
 .../log4j/core/appender/FileManager.java        |  12 +-
 .../core/appender/OutputStreamManager.java      |  18 +-
 .../core/appender/RollingFileAppender.java      | 372 ++++++++++++-------
 .../appender/rolling/RollingFileManager.java    |  50 ++-
 .../rolling/OnStartupTriggeringPolicyTest.java  |  10 +-
 .../rolling/RollingAppenderSizeTest.java        |  43 ++-
 .../rolling/RollingFileAppenderAccessTest.java  |  61 +--
 .../test/resources/log4j-rolling-7z-lazy.xml    |  59 +++
 .../test/resources/log4j-rolling-bzip2-lazy.xml |  60 +++
 .../resources/log4j-rolling-deflate-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-gz-lazy.xml    |  59 +++
 .../resources/log4j-rolling-pack200-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-xz-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-zip-lazy.xml   |  60 +++
 src/changes/changes.xml                         |   5 +-
 15 files changed, 791 insertions(+), 198 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java
index c71bd95..b8a559a 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java
@@ -45,6 +45,9 @@ public class FileManager extends OutputStreamManager {
     private final String advertiseURI;
     private final int bufferSize;
 
+    /**
+     * @deprecated
+     */
     @Deprecated
     protected FileManager(final String fileName, final OutputStream os, final boolean append, final boolean locking,
             final String advertiseURI, final Layout<? extends Serializable> layout, final int bufferSize,
@@ -53,7 +56,7 @@ public class FileManager extends OutputStreamManager {
     }
 
     /**
-     * @deprecated 
+     * @deprecated
      * @since 2.6 
      */
     @Deprecated
@@ -72,10 +75,10 @@ public class FileManager extends OutputStreamManager {
      * @throws IOException 
      * @since 2.7 
      */
-    protected FileManager(final String fileName, final boolean append, final boolean locking, final boolean lazyCreate,
+    protected FileManager(final String fileName, final OutputStream os, final boolean append, final boolean locking, final boolean lazyCreate,
             final String advertiseURI, final Layout<? extends Serializable> layout, final boolean writeHeader,
             final ByteBuffer buffer) throws IOException {
-        super(fileName, lazyCreate, layout, writeHeader, buffer);
+        super(os, fileName, lazyCreate, layout, writeHeader, buffer);
         this.isAppend = append;
         this.isLazyCreate = lazyCreate;
         this.isLocking = locking;
@@ -253,7 +256,8 @@ public class FileManager extends OutputStreamManager {
             try {
                 final int actualSize = data.bufferedIO ? data.bufferSize : Constants.ENCODER_BYTE_BUFFER_SIZE;
                 final ByteBuffer buffer = ByteBuffer.wrap(new byte[actualSize]);
-                return new FileManager(name, data.append, data.locking, data.lazyCreate, data.advertiseURI, data.layout,
+                final FileOutputStream fos = data.lazyCreate ? null : new FileOutputStream(file, data.append);
+                return new FileManager(name, fos, data.append, data.locking, data.lazyCreate, data.advertiseURI, data.layout,
                         writeHeader, buffer);
             } catch (final IOException ex) {
                 LOGGER.error("FileManager (" + name + ") " + ex, ex);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
index e707bea..d895dd5 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
@@ -43,12 +43,6 @@ public class OutputStreamManager extends AbstractManager implements ByteBufferDe
     }
 
     /**
-     *
-     * @param os
-     * @param streamName
-     * @param layout
-     * @param writeHeader
-     * @param byteBuffer
      * @since 2.6
      * @deprecated
      */
@@ -72,17 +66,21 @@ public class OutputStreamManager extends AbstractManager implements ByteBufferDe
     }
 
     /**
-     * @param byteBuffer
      * @throws IOException 
      * @since 2.7
      */
-    protected OutputStreamManager(final String streamName, final boolean lazyCreate, final Layout<? extends Serializable> layout,
-            final boolean writeHeader, final ByteBuffer byteBuffer)
+    protected OutputStreamManager(OutputStream os, final String streamName, final boolean lazyCreate,
+            final Layout<? extends Serializable> layout, final boolean writeHeader, final ByteBuffer byteBuffer)
             throws IOException {
         super(streamName);
+        if (lazyCreate && os != null) {
+            LOGGER.error(
+                    "Invalid OutputStreamManager configuration for '{}': You cannot both set the OutputStream and request on-demand.",
+                    streamName);
+        }
         this.layout = layout;
         this.byteBuffer = Objects.requireNonNull(byteBuffer, "byteBuffer");
-        this.os = lazyCreate ? null : createOutputStream();
+        this.os = os;
         if (writeHeader && layout != null) {
             final byte[] header = layout.getHeader();
             if (header != null) {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
index 01ef50d..dc830e3 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
@@ -31,9 +31,12 @@ import org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy;
 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.PluginBuilderAttribute;
+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.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.config.plugins.validation.constraints.Required;
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.net.Advertiser;
 import org.apache.logging.log4j.core.util.Booleans;
@@ -45,6 +48,215 @@ import org.apache.logging.log4j.core.util.Integers;
 @Plugin(name = "RollingFile", category = "Core", elementType = "appender", printObject = true)
 public final class RollingFileAppender extends AbstractOutputStreamAppender<RollingFileManager> {
 
+    /**
+     * Builds FileAppender instances.
+     * 
+     * @param <B>
+     *            This builder class
+     */
+    public static class Builder<B extends Builder<B>> extends AbstractOutputStreamAppender.Builder<B>
+            implements org.apache.logging.log4j.core.util.Builder<RollingFileAppender> {
+
+        @PluginBuilderAttribute
+        @Required
+        private String fileName;
+
+        @PluginBuilderAttribute
+        @Required
+        private String filePattern;
+
+        @PluginBuilderAttribute
+        private boolean append = true;
+
+        @PluginBuilderAttribute
+        private boolean locking;
+
+        @PluginElement("Policy") 
+        @Required
+        private TriggeringPolicy policy;
+        
+        @PluginElement("Strategy") 
+        private RolloverStrategy strategy;
+
+        @PluginBuilderAttribute
+        private boolean bufferedIo = true;
+
+        @PluginBuilderAttribute
+        private int bufferSize = DEFAULT_BUFFER_SIZE;
+
+        @PluginBuilderAttribute
+        private boolean advertise;
+
+        @PluginBuilderAttribute
+        private String advertiseUri;
+
+        @PluginBuilderAttribute
+        private boolean lazyCreate;
+
+        @PluginConfiguration
+        private Configuration config;
+
+        @Override
+        public RollingFileAppender build() {
+            // Even though some variables may be annotated with @Required, we must still perform validation here for
+            // call sites that build builders programmatically.
+            if (getName() == null) {
+                LOGGER.error("RollingFileAppender '{}': No name provided.", getName());
+                return null;
+            }
+
+            if (!bufferedIo && bufferSize > 0) {
+                LOGGER.warn("RollingFileAppender '{}': The bufferSize is set to {} but bufferedIO is not true", getName(), bufferSize);
+            }
+
+            if (fileName == null) {
+                LOGGER.error("RollingFileAppender '{}': No file name provided.", getName());
+                return null;
+            }
+
+            if (filePattern == null) {
+                LOGGER.error("RollingFileAppender '{}': No file name pattern provided.", getName());
+                return null;
+            }
+
+            if (policy == null) {
+                LOGGER.error("RollingFileAppender '{}': No TriggeringPolicy provided.", getName());
+                return null;
+            }
+
+            if (strategy == null) {
+                strategy = DefaultRolloverStrategy.createStrategy(null, null, null,
+                        String.valueOf(Deflater.DEFAULT_COMPRESSION), null, true, config);
+            }
+
+            if (strategy == null) {
+                strategy = DefaultRolloverStrategy.createStrategy(null, null, null,
+                        String.valueOf(Deflater.DEFAULT_COMPRESSION), null, true, config);
+            }
+
+            final RollingFileManager manager = RollingFileManager.getFileManager(fileName, filePattern, append,
+                    bufferedIo, policy, strategy, advertiseUri, getLayout(), bufferSize, isImmediateFlush(),
+                    lazyCreate);
+            if (manager == null) {
+                return null;
+            }
+
+            manager.initialize();
+
+            return new RollingFileAppender(getName(), getLayout(), getFilter(), manager, fileName, filePattern,
+                    isIgnoreExceptions(), isImmediateFlush(), advertise ? config.getAdvertiser() : null);
+        }
+
+        public String getAdvertiseUri() {
+            return advertiseUri;
+        }
+
+        public int getBufferSize() {
+            return bufferSize;
+        }
+
+        public Configuration getConfig() {
+            return config;
+        }
+
+        public String getFileName() {
+            return fileName;
+        }
+
+        public boolean isAdvertise() {
+            return advertise;
+        }
+
+        public boolean isAppend() {
+            return append;
+        }
+
+        public boolean isBufferedIo() {
+            return bufferedIo;
+        }
+
+        public boolean isLazyCreate() {
+            return lazyCreate;
+        }
+
+        public boolean isLocking() {
+            return locking;
+        }
+
+        public B withAdvertise(final boolean advertise) {
+            this.advertise = advertise;
+            return asBuilder();
+        }
+
+        public B withAdvertiseUri(final String advertiseUri) {
+            this.advertiseUri = advertiseUri;
+            return asBuilder();
+        }
+
+        public B withAppend(final boolean append) {
+            this.append = append;
+            return asBuilder();
+        }
+
+        public B withBufferedIo(final boolean bufferedIo) {
+            this.bufferedIo = bufferedIo;
+            return asBuilder();
+        }
+
+        public B withBufferSize(final int bufferSize) {
+            this.bufferSize = bufferSize;
+            return asBuilder();
+        }
+
+        public B withConfig(final Configuration config) {
+            this.config = config;
+            return asBuilder();
+        }
+
+        public B withFileName(final String fileName) {
+            this.fileName = fileName;
+            return asBuilder();
+        }
+
+        public B withLazyCreate(final boolean lazyCreate) {
+            this.lazyCreate = lazyCreate;
+            return asBuilder();
+        }
+
+        public B withLocking(final boolean locking) {
+            this.locking = locking;
+            return asBuilder();
+        }
+
+        public String getFilePattern() {
+            return filePattern;
+        }
+
+        public TriggeringPolicy getPolicy() {
+            return policy;
+        }
+
+        public RolloverStrategy getStrategy() {
+            return strategy;
+        }
+
+        public B withFilePattern(String filePattern) {
+            this.filePattern = filePattern;
+            return asBuilder();
+        }
+
+        public B withPolicy(TriggeringPolicy policy) {
+            this.policy = policy;
+            return asBuilder();
+        }
+
+        public B withStrategy(RolloverStrategy strategy) {
+            this.strategy = strategy;
+            return asBuilder();
+        }
+
+    }
+    
     private static final int DEFAULT_BUFFER_SIZE = 8192;
 
     private final String fileName;
@@ -128,9 +340,10 @@ public final class RollingFileAppender extends AbstractOutputStreamAppender<Roll
      * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
      *               they are propagated to the caller.
      * @param advertise "true" if the appender configuration should be advertised, "false" otherwise.
-     * @param advertiseURI The advertised URI which can be used to retrieve the file contents.
+     * @param advertiseUri The advertised URI which can be used to retrieve the file contents.
      * @param config The Configuration.
      * @return A RollingFileAppender.
+     * @deprecated Use {@link #newBuilder()}.
      */
     @Deprecated
     public static RollingFileAppender createAppender(
@@ -148,142 +361,35 @@ public final class RollingFileAppender extends AbstractOutputStreamAppender<Roll
             final Filter filter,
             final String ignore,
             final String advertise,
-            final String advertiseURI,
+            final String advertiseUri,
             final Configuration config) {
             // @formatter:on
-
-        final boolean isAppend = Booleans.parseBoolean(append, true);
-        final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
-        final boolean isBuffered = Booleans.parseBoolean(bufferedIO, true);
-        final boolean isFlush = Booleans.parseBoolean(immediateFlush, true);
-        final boolean isAdvertise = Boolean.parseBoolean(advertise);
         final int bufferSize = Integers.parseInt(bufferSizeStr, DEFAULT_BUFFER_SIZE);
-        if (!isBuffered && bufferSize > 0) {
-            LOGGER.warn("The bufferSize is set to {} but bufferedIO is not true: {}", bufferSize, bufferedIO);
-        }
-        if (name == null) {
-            LOGGER.error("No name provided for FileAppender");
-            return null;
-        }
-
-        if (fileName == null) {
-            LOGGER.error("No filename was provided for FileAppender with name "  + name);
-            return null;
-        }
-
-        if (filePattern == null) {
-            LOGGER.error("No filename pattern provided for FileAppender with name "  + name);
-            return null;
-        }
-
-        if (policy == null) {
-            LOGGER.error("A TriggeringPolicy must be provided");
-            return null;
-        }
-
-        if (strategy == null) {
-            strategy = DefaultRolloverStrategy.createStrategy(null, null, null,
-                    String.valueOf(Deflater.DEFAULT_COMPRESSION), null, true, config);
-        }
-
-        if (layout == null) {
-            layout = PatternLayout.createDefaultLayout();
-        }
-
-        final RollingFileManager manager = RollingFileManager.getFileManager(fileName, filePattern, isAppend,
-            isBuffered, policy, strategy, advertiseURI, layout, bufferSize, isFlush);
-        if (manager == null) {
-            return null;
-        }
-
-        manager.initialize();
-
-        return new RollingFileAppender(name, layout, filter, manager, fileName, filePattern,
-                ignoreExceptions, isFlush, isAdvertise ? config.getAdvertiser() : null);
+        // @formatter:off
+        return newBuilder()
+                .withAdvertise(Boolean.parseBoolean(advertise))
+                .withAdvertiseUri(advertiseUri)
+                .withAppend(Booleans.parseBoolean(append, true))
+                .withBufferedIo(Booleans.parseBoolean(bufferedIO, true))
+                .withBufferSize(bufferSize)
+                .withConfig(config)
+                .withFileName(fileName)
+                .withFilePattern(filePattern)
+                .withFilter(filter)
+                .withIgnoreExceptions(Booleans.parseBoolean(ignore, true))
+                .withImmediateFlush(Booleans.parseBoolean(immediateFlush, true))
+                .withLayout(layout)
+                .withLazyCreate(false)
+                .withLocking(false)
+                .withName(name)
+                .withPolicy(policy)
+                .withStrategy(strategy)
+                .build();
+        // @formatter:on
     }
 
-    /**
-     * Creates a RollingFileAppender.
-     * @param fileName The name of the file that is actively written to. (required).
-     * @param filePattern The pattern of the file name to use on rollover. (required).
-     * @param append If true, events are appended to the file. If false, the file
-     * is overwritten when opened. Defaults to "true"
-     * @param name The name of the Appender (required).
-     * @param bufferedIo When true, I/O will be buffered. Defaults to "true".
-     * @param bufferSize buffer size for buffered IO (default is 8192).
-     * @param immediateFlush When true, events are immediately flushed. Defaults to "true".
-     * @param policy The triggering policy. (required).
-     * @param strategy The rollover strategy. Defaults to DefaultRolloverStrategy.
-     * @param layout The layout to use (defaults to the default PatternLayout).
-     * @param filter The Filter or null.
-     * @param ignoreExceptions If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
-     *               they are propagated to the caller.
-     * @param advertise "true" if the appender configuration should be advertised, "false" otherwise.
-     * @param advertiseURI The advertised URI which can be used to retrieve the file contents.
-     * @param config The Configuration.
-     * @return A RollingFileAppender.
-     * @since 2.7
-     */
-    @PluginFactory
-    public static RollingFileAppender createAppender(
-            // @formatter:off
-            @PluginAttribute("fileName") final String fileName,
-            @PluginAttribute("filePattern") final String filePattern,
-            @PluginAttribute(value = "append", defaultBoolean = true) final boolean append,
-            @PluginAttribute("name") final String name,
-            @PluginAttribute(value = "bufferedIO", defaultBoolean = true) final boolean bufferedIo,
-            @PluginAttribute(value = "bufferSize", defaultInt = DEFAULT_BUFFER_SIZE) final int bufferSize,
-            @PluginAttribute(value = "immediateFlush" , defaultBoolean = true) final boolean immediateFlush,
-            @PluginElement("Policy") final TriggeringPolicy policy,
-            @PluginElement("Strategy") RolloverStrategy strategy,
-            @PluginElement("Layout") Layout<? extends Serializable> layout,
-            @PluginElement("Filter") final Filter filter,
-            @PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) final boolean ignoreExceptions,
-            @PluginAttribute("advertise") final boolean advertise,
-            @PluginAttribute("advertiseURI") final String advertiseURI,
-            @PluginConfiguration final Configuration config) {
-            // @formatter:on
-        if (!bufferedIo && bufferSize > 0) {
-            LOGGER.warn("The bufferSize is set to {} but bufferedIO is not true: {}", bufferSize, bufferedIo);
-        }
-        if (name == null) {
-            LOGGER.error("No name provided for FileAppender");
-            return null;
-        }
-
-        if (fileName == null) {
-            LOGGER.error("No filename was provided for FileAppender with name "  + name);
-            return null;
-        }
-
-        if (filePattern == null) {
-            LOGGER.error("No filename pattern provided for FileAppender with name "  + name);
-            return null;
-        }
-
-        if (policy == null) {
-            LOGGER.error("A TriggeringPolicy must be provided");
-            return null;
-        }
-
-        if (strategy == null) {
-            strategy = DefaultRolloverStrategy.createStrategy(null, null, null,
-                    String.valueOf(Deflater.DEFAULT_COMPRESSION), null, true, config);
-        }
-
-        if (layout == null) {
-            layout = PatternLayout.createDefaultLayout();
-        }
-
-        final RollingFileManager manager = RollingFileManager.getFileManager(fileName, filePattern, append,
-            bufferedIo, policy, strategy, advertiseURI, layout, bufferSize, immediateFlush);
-        if (manager == null) {
-            return null;
-        }
-
-        manager.initialize();
-
-        return new RollingFileAppender(name, layout, filter, manager, fileName, filePattern,
-                ignoreExceptions, immediateFlush, advertise ? config.getAdvertiser() : null);
+    @PluginBuilderFactory
+    public static <B extends Builder<B>> B newBuilder() {
+        return new Builder<B>().asBuilder();
     }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
index 4fdbf30..5f390f1 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
@@ -32,6 +32,7 @@ import org.apache.logging.log4j.core.appender.FileManager;
 import org.apache.logging.log4j.core.appender.ManagerFactory;
 import org.apache.logging.log4j.core.appender.rolling.action.AbstractAction;
 import org.apache.logging.log4j.core.appender.rolling.action.Action;
+import org.apache.logging.log4j.core.util.Clock;
 import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.core.util.Log4jThread;
 
@@ -65,6 +66,7 @@ public class RollingFileManager extends FileManager {
                 writeHeader, ByteBuffer.wrap(new byte[Constants.ENCODER_BYTE_BUFFER_SIZE]));
     }
 
+    @Deprecated
     protected RollingFileManager(final String fileName, final String pattern, final OutputStream os,
             final boolean append, final long size, final long time, final TriggeringPolicy triggeringPolicy,
             final RolloverStrategy rolloverStrategy, final String advertiseURI,
@@ -78,6 +80,24 @@ public class RollingFileManager extends FileManager {
         this.patternProcessor.setPrevFileTime(time);
     }
 
+    /**
+     * @throws IOException 
+     * @since 2.7
+     */
+    protected RollingFileManager(final String fileName, final String pattern, final OutputStream os, final boolean append,
+            final boolean lazyCreate, final long size, final long time, final TriggeringPolicy triggeringPolicy,
+            final RolloverStrategy rolloverStrategy, final String advertiseURI,
+            final Layout<? extends Serializable> layout, final boolean writeHeader, final ByteBuffer buffer)
+            throws IOException {
+        super(fileName, os, append, false, lazyCreate, advertiseURI, layout, writeHeader, buffer);
+        this.size = size;
+        this.initialTime = time;
+        this.triggeringPolicy = triggeringPolicy;
+        this.rolloverStrategy = rolloverStrategy;
+        this.patternProcessor = new PatternProcessor(pattern);
+        this.patternProcessor.setPrevFileTime(time);
+    }
+
     public void initialize() {
         triggeringPolicy.initialize(this);
     }
@@ -93,15 +113,17 @@ public class RollingFileManager extends FileManager {
      * @param advertiseURI the URI to use when advertising the file
      * @param layout The Layout.
      * @param bufferSize buffer size to use if bufferedIO is true
+     * @param immediateFlush flush on every write or not
+     * @param lazyCreate true if you want to lazy-create the file (a.k.a. on-demand.)
      * @return A RollingFileManager.
      */
     public static RollingFileManager getFileManager(final String fileName, final String pattern, final boolean append,
             final boolean bufferedIO, final TriggeringPolicy policy, final RolloverStrategy strategy,
             final String advertiseURI, final Layout<? extends Serializable> layout, final int bufferSize,
-            final boolean immediateFlush) {
+            final boolean immediateFlush, final boolean lazyCreate) {
 
         return (RollingFileManager) getManager(fileName, new FactoryData(pattern, append,
-            bufferedIO, policy, strategy, advertiseURI, layout, bufferSize, immediateFlush), factory);
+            bufferedIO, policy, strategy, advertiseURI, layout, bufferSize, immediateFlush, lazyCreate), factory);
     }
 
     // override to make visible for unit tests
@@ -325,6 +347,7 @@ public class RollingFileManager extends FileManager {
         private final boolean bufferedIO;
         private final int bufferSize;
         private final boolean immediateFlush;
+        private final boolean lazyCreate;
         private final TriggeringPolicy policy;
         private final RolloverStrategy strategy;
         private final String advertiseURI;
@@ -339,10 +362,12 @@ public class RollingFileManager extends FileManager {
          * @param layout The Layout.
          * @param bufferSize the buffer size
          * @param immediateFlush flush on every write or not
+         * @param lazyCreate true if you want to lazy-create the file (a.k.a. on-demand.)
          */
         public FactoryData(final String pattern, final boolean append, final boolean bufferedIO,
                 final TriggeringPolicy policy, final RolloverStrategy strategy, final String advertiseURI,
-                final Layout<? extends Serializable> layout, final int bufferSize, final boolean immediateFlush) {
+                final Layout<? extends Serializable> layout, final int bufferSize, final boolean immediateFlush, 
+                final boolean lazyCreate) {
             this.pattern = pattern;
             this.append = append;
             this.bufferedIO = bufferedIO;
@@ -352,6 +377,7 @@ public class RollingFileManager extends FileManager {
             this.advertiseURI = advertiseURI;
             this.layout = layout;
             this.immediateFlush = immediateFlush;
+            this.lazyCreate = lazyCreate;
         }
 
         public TriggeringPolicy getTriggeringPolicy()
@@ -418,24 +444,24 @@ public class RollingFileManager extends FileManager {
             // LOG4J2-1140: check writeHeader before creating the file
             final boolean writeHeader = !data.append || !file.exists();
             try {
-                file.createNewFile();
+                final boolean created = data.lazyCreate ? false : file.createNewFile();
+                LOGGER.trace("New file '{}' created = {}", name, created);
             } catch (final IOException ioe) {
                 LOGGER.error("Unable to create file " + name, ioe);
                 return null;
             }
             final long size = data.append ? file.length() : 0;
 
-            OutputStream os;
             try {
-                os = new FileOutputStream(name, data.append);
                 final int actualSize = data.bufferedIO ? data.bufferSize : Constants.ENCODER_BYTE_BUFFER_SIZE;
                 final ByteBuffer buffer = ByteBuffer.wrap(new byte[actualSize]);
-
-                final long time = file.lastModified(); // LOG4J2-531 create file first so time has valid value
-                return new RollingFileManager(name, data.pattern, os, data.append, size, time, data.policy,
-                    data.strategy, data.advertiseURI, data.layout, writeHeader, buffer);
-            } catch (final FileNotFoundException ex) {
-                LOGGER.error("FileManager (" + name + ") " + ex, ex);
+                final OutputStream os = data.lazyCreate ? null : new FileOutputStream(name, data.append);
+                final long time = data.lazyCreate? System.currentTimeMillis() : file.lastModified(); // LOG4J2-531 create file first so time has valid value
+                
+                return new RollingFileManager(name, data.pattern, os, data.append, data.lazyCreate, size, time, data.policy,
+                        data.strategy, data.advertiseURI, data.layout, writeHeader, buffer);
+            } catch (final IOException ex) {
+                LOGGER.error("RollingFileManager (" + name + ") " + ex, ex);
             }
             return null;
         }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java
index eacf7c6..27f8e7e 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java
@@ -32,7 +32,9 @@ import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.DefaultConfiguration;
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.util.datetime.FastDateFormat;
+import org.apache.logging.log4j.junit.CleanFolders;
 import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
 
 /**
@@ -49,8 +51,8 @@ public class OnStartupTriggeringPolicyTest {
     private static final String TEST_DATA = "Hello world!";
     private static final FastDateFormat formatter = FastDateFormat.getInstance("MM-dd-yyyy");
 
-    // @Rule
-    // public CleanFolders rule = new CleanFolders("target/rollOnStartup");
+    @Rule
+    public CleanFolders rule = new CleanFolders("target/rollOnStartup");
 
     @Test
     public void testPolicy() throws Exception {
@@ -76,13 +78,13 @@ public class OnStartupTriggeringPolicyTest {
                 configuration);
         final OnStartupTriggeringPolicy policy = OnStartupTriggeringPolicy.createPolicy(1);
         final RollingFileManager manager = RollingFileManager.getFileManager(TARGET_FILE, TARGET_PATTERN, true, false,
-                policy, strategy, null, layout, 8192, true);
+                policy, strategy, null, layout, 8192, true, false);
         try {
             manager.initialize();
             String files = Arrays.toString(new File(TARGET_FOLDER).listFiles());
             assertTrue(target.toString() + ", files = " + files, Files.exists(target));
             assertEquals(target.toString(), 0, Files.size(target));
-            assertTrue(rolled.toString() + ", files = " + files, Files.exists(rolled));
+            assertTrue("Missing: " + rolled.toString() + ", files on disk = " + files, Files.exists(rolled));
             assertEquals(rolled.toString(), size, Files.size(rolled));
         } finally {
             manager.release();

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
index 92e89b1..0560301 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
@@ -29,6 +29,9 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Collection;
 
@@ -37,8 +40,10 @@ import org.apache.commons.compress.compressors.CompressorInputStream;
 import org.apache.commons.compress.compressors.CompressorStreamFactory;
 import org.apache.commons.compress.utils.IOUtils;
 import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.appender.RollingFileAppender;
 import org.apache.logging.log4j.core.util.Closer;
 import org.apache.logging.log4j.junit.LoggerContextRule;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -61,25 +66,34 @@ public class RollingAppenderSizeTest {
 
     private Logger logger;
 
-    @Parameterized.Parameters(name = "{0} \u2192 {1}")
+    private final boolean lazyCreate;
+
+    @Parameterized.Parameters(name = "{0} \u2192 {1} (lazyCreate = {2})")
     public static Collection<Object[]> data() {
         return Arrays.asList(new Object[][] { //
                 // @formatter:off
-                {"log4j-rolling-gz.xml", ".gz"}, //
-                {"log4j-rolling-zip.xml", ".zip"}, //
+               {"log4j-rolling-gz-lazy.xml", ".gz", true}, //
+               {"log4j-rolling-gz.xml", ".gz", false}, //
+               {"log4j-rolling-zip-lazy.xml", ".zip", true}, //
+               {"log4j-rolling-zip.xml", ".zip", false}, //
                 // Apache Commons Compress
-                {"log4j-rolling-bzip2.xml", ".bz2"}, //
-                {"log4j-rolling-deflate.xml", ".deflate"}, //
-                {"log4j-rolling-pack200.xml", ".pack200"}, //
-                {"log4j-rolling-xz.xml", ".xz"}, //
+               {"log4j-rolling-bzip2-lazy.xml", ".bz2", true}, //
+               {"log4j-rolling-bzip2.xml", ".bz2", false}, //
+               {"log4j-rolling-deflate-lazy.xml", ".deflate", true}, //
+               {"log4j-rolling-deflate.xml", ".deflate", false}, //
+               {"log4j-rolling-pack200-lazy.xml", ".pack200", true}, //
+               {"log4j-rolling-pack200.xml", ".pack200", false}, //
+               {"log4j-rolling-xz-lazy.xml", ".xz", true}, //
+               {"log4j-rolling-xz.xml", ".xz", false}, //
                 });
                 // @formatter:on
     }
 
     private LoggerContextRule loggerContextRule;
 
-    public RollingAppenderSizeTest(final String configFile, final String fileExtension) {
+    public RollingAppenderSizeTest(final String configFile, final String fileExtension, final boolean lazyCreate) {
         this.fileExtension = fileExtension;
+        this.lazyCreate = lazyCreate;
         this.loggerContextRule = new LoggerContextRule(configFile);
         this.chain = loggerContextRule.withCleanFoldersRule(DIR);
     }
@@ -90,7 +104,20 @@ public class RollingAppenderSizeTest {
     }
 
     @Test
+    public void testIsLazyCreate() {
+        final RollingFileAppender rfAppender = loggerContextRule.getRequiredAppender("RollingFile",
+                RollingFileAppender.class);
+        final RollingFileManager manager = rfAppender.getManager();
+        Assert.assertNotNull(manager);
+        Assert.assertEquals(lazyCreate, manager.isLazyCreate());
+    }
+
+    @Test
     public void testAppender() throws Exception {
+        final Path path = Paths.get(DIR, "rollingtest.log");
+        if (Files.exists(path) && lazyCreate) {
+            Assert.fail(String.format("Unexpected file: %s (%s bytes)", path, Files.getAttribute(path, "size")));
+        }
         for (int i = 0; i < 100; ++i) {
             logger.debug("This is test message number " + i);
         }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderAccessTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderAccessTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderAccessTest.java
index d22fc6a..b484567 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderAccessTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderAccessTest.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.appender.RollingFileAppender;
 import org.apache.logging.log4j.core.config.Configuration;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class RollingFileAppenderAccessTest {
@@ -32,19 +33,26 @@ public class RollingFileAppenderAccessTest {
      * @throws IOException
      */
     @Test
-    public void testAccessManagerWithStrings() throws IOException {
-        final LoggerContext ctx = LoggerContext.getContext(false);
-        final Configuration config = ctx.getConfiguration();
-        final File file = File.createTempFile("RollingFileAppenderAccessTest", ".tmp");
-        file.deleteOnExit();
-        final RollingFileAppender appender = RollingFileAppender.createAppender(file.getCanonicalPath(), "FilePattern",
-                null, "Name", null, null, null, OnStartupTriggeringPolicy.createPolicy(1), null, null, null, null, null,
-                null, config);
-        final RollingFileManager manager = appender.getManager();
-        // Since the RolloverStrategy and TriggeringPolicy are immutable, we could also use generics to type their
-        // access.
-        manager.getRolloverStrategy();
-        manager.getTriggeringPolicy();
+    public void testAccessManagerWithBuilder() throws IOException {
+        try (final LoggerContext ctx = LoggerContext.getContext(false)) {
+            final Configuration config = ctx.getConfiguration();
+            final File file = File.createTempFile("RollingFileAppenderAccessTest", ".tmp");
+            file.deleteOnExit();
+            // @formatter:off
+            final RollingFileAppender appender = RollingFileAppender.newBuilder()
+                    .withFileName(file.getCanonicalPath())
+                    .withFilePattern("FilePattern")
+                    .withName("Name")
+                    .withPolicy(OnStartupTriggeringPolicy.createPolicy(1))
+                    .withConfig(config)
+                    .build();
+            // @formatter:on
+            final RollingFileManager manager = appender.getManager();
+            // Since the RolloverStrategy and TriggeringPolicy are immutable, we could also use generics to type their
+            // access.
+            Assert.assertNotNull(manager.getRolloverStrategy());
+            Assert.assertNotNull(manager.getTriggeringPolicy());
+        }
     }
 
     /**
@@ -53,18 +61,19 @@ public class RollingFileAppenderAccessTest {
      * @throws IOException
      */
     @Test
-    public void testAccessManagerWithPrimitives() throws IOException {
-        final LoggerContext ctx = LoggerContext.getContext(false);
-        final Configuration config = ctx.getConfiguration();
-        final File file = File.createTempFile("RollingFileAppenderAccessTest", ".tmp");
-        file.deleteOnExit();
-        final RollingFileAppender appender = RollingFileAppender.createAppender(file.getCanonicalPath(), "FilePattern",
-                true, "Name", true, 8192, true, OnStartupTriggeringPolicy.createPolicy(1), null, null, null, true, false,
-                null, config);
-        final RollingFileManager manager = appender.getManager();
-        // Since the RolloverStrategy and TriggeringPolicy are immutable, we could also use generics to type their
-        // access.
-        manager.getRolloverStrategy();
-        manager.getTriggeringPolicy();
+    public void testAccessManagerWithStrings() throws IOException {
+        try (final LoggerContext ctx = LoggerContext.getContext(false)) {
+            final Configuration config = ctx.getConfiguration();
+            final File file = File.createTempFile("RollingFileAppenderAccessTest", ".tmp");
+            file.deleteOnExit();
+            final RollingFileAppender appender = RollingFileAppender.createAppender(file.getCanonicalPath(),
+                    "FilePattern", null, "Name", null, null, null, OnStartupTriggeringPolicy.createPolicy(1), null,
+                    null, null, null, null, null, config);
+            final RollingFileManager manager = appender.getManager();
+            // Since the RolloverStrategy and TriggeringPolicy are immutable, we could also use generics to type their
+            // access.
+            Assert.assertNotNull(manager.getRolloverStrategy());
+            Assert.assertNotNull(manager.getTriggeringPolicy());
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml
new file mode 100644
index 0000000..ce16320
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="OFF" name="XMLConfigTest">
+  <Properties>
+    <Property name="filename">target/rolling1/rollingtest.log</Property>
+  </Properties>
+  <ThresholdFilter level="debug"/>
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <RollingFile name="RollingFile" fileName="${filename}"
+                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.7z"
+                 lazyCreate="true">
+      <PatternLayout>
+        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+      </PatternLayout>
+      <SizeBasedTriggeringPolicy size="500" />
+    </RollingFile>
+    <List name="List">
+      <ThresholdFilter level="error"/>
+    </List>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <ThreadContextMapFilter>
+        <KeyValuePair key="test" value="123"/>
+      </ThreadContextMapFilter>
+      <AppenderRef ref="STDOUT"/>
+    </Logger>>
+
+    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
+      <AppenderRef ref="RollingFile"/>
+    </Logger>>
+
+    <Root level="error">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml
new file mode 100644
index 0000000..6697293
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="OFF" name="XMLConfigTest">
+  <Properties>
+    <Property name="filename">target/rolling1/rollingtest.log</Property>
+  </Properties>
+  <ThresholdFilter level="debug"/>
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <RollingFile name="RollingFile" fileName="${filename}"
+                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.bz2"
+                 lazyCreate="true">
+      <PatternLayout>
+        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+      </PatternLayout>
+      <SizeBasedTriggeringPolicy size="500" />
+      <DefaultRolloverStrategy compressionLevel="9" />
+    </RollingFile>
+    <List name="List">
+      <ThresholdFilter level="error"/>
+    </List>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <ThreadContextMapFilter>
+        <KeyValuePair key="test" value="123"/>
+      </ThreadContextMapFilter>
+      <AppenderRef ref="STDOUT"/>
+    </Logger>>
+
+    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
+      <AppenderRef ref="RollingFile"/>
+    </Logger>>
+
+    <Root level="error">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml
new file mode 100644
index 0000000..d4561f7
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="OFF" name="XMLConfigTest">
+  <Properties>
+    <Property name="filename">target/rolling1/rollingtest.log</Property>
+  </Properties>
+  <ThresholdFilter level="debug"/>
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <RollingFile name="RollingFile" fileName="${filename}"
+                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.deflate"
+                 lazyCreate="true">
+      <PatternLayout>
+        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+      </PatternLayout>
+      <SizeBasedTriggeringPolicy size="500" />
+      <DefaultRolloverStrategy compressionLevel="9" />
+    </RollingFile>
+    <List name="List">
+      <ThresholdFilter level="error"/>
+    </List>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <ThreadContextMapFilter>
+        <KeyValuePair key="test" value="123"/>
+      </ThreadContextMapFilter>
+      <AppenderRef ref="STDOUT"/>
+    </Logger>>
+
+    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
+      <AppenderRef ref="RollingFile"/>
+    </Logger>>
+
+    <Root level="error">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml
new file mode 100644
index 0000000..f9bfd90
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="OFF" name="XMLConfigTest">
+  <Properties>
+    <Property name="filename">target/rolling1/rollingtest.log</Property>
+  </Properties>
+  <ThresholdFilter level="debug"/>
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <RollingFile name="RollingFile" fileName="${filename}"
+                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.gz"
+                 lazyCreate="true">
+      <PatternLayout>
+        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+      </PatternLayout>
+      <SizeBasedTriggeringPolicy size="500" />
+    </RollingFile>
+    <List name="List">
+      <ThresholdFilter level="error"/>
+    </List>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <ThreadContextMapFilter>
+        <KeyValuePair key="test" value="123"/>
+      </ThreadContextMapFilter>
+      <AppenderRef ref="STDOUT"/>
+    </Logger>>
+
+    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
+      <AppenderRef ref="RollingFile"/>
+    </Logger>>
+
+    <Root level="error">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml
new file mode 100644
index 0000000..7355e61
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="OFF" name="XMLConfigTest">
+  <Properties>
+    <Property name="filename">target/rolling1/rollingtest.log</Property>
+  </Properties>
+  <ThresholdFilter level="debug"/>
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <RollingFile name="RollingFile" fileName="${filename}"
+                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.pack200"
+                 lazyCreate="true">
+      <PatternLayout>
+        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+      </PatternLayout>
+      <SizeBasedTriggeringPolicy size="500" />
+      <DefaultRolloverStrategy compressionLevel="9" />
+    </RollingFile>
+    <List name="List">
+      <ThresholdFilter level="error"/>
+    </List>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <ThreadContextMapFilter>
+        <KeyValuePair key="test" value="123"/>
+      </ThreadContextMapFilter>
+      <AppenderRef ref="STDOUT"/>
+    </Logger>>
+
+    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
+      <AppenderRef ref="RollingFile"/>
+    </Logger>>
+
+    <Root level="error">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml
new file mode 100644
index 0000000..02aa528
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="OFF" name="XMLConfigTest">
+  <Properties>
+    <Property name="filename">target/rolling1/rollingtest.log</Property>
+  </Properties>
+  <ThresholdFilter level="debug"/>
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <RollingFile name="RollingFile" fileName="${filename}"
+                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.xz"
+                 lazyCreate="true">
+      <PatternLayout>
+        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+      </PatternLayout>
+      <SizeBasedTriggeringPolicy size="500" />
+      <DefaultRolloverStrategy compressionLevel="9" />
+    </RollingFile>
+    <List name="List">
+      <ThresholdFilter level="error"/>
+    </List>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <ThreadContextMapFilter>
+        <KeyValuePair key="test" value="123"/>
+      </ThreadContextMapFilter>
+      <AppenderRef ref="STDOUT"/>
+    </Logger>>
+
+    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
+      <AppenderRef ref="RollingFile"/>
+    </Logger>>
+
+    <Root level="error">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml
new file mode 100644
index 0000000..2641d7f
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="OFF" name="XMLConfigTest">
+  <Properties>
+    <Property name="filename">target/rolling1/rollingtest.log</Property>
+  </Properties>
+  <ThresholdFilter level="debug"/>
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <RollingFile name="RollingFile" fileName="${filename}"
+                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.zip"
+                 lazyCreate="true">
+      <PatternLayout>
+        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+      </PatternLayout>
+      <SizeBasedTriggeringPolicy size="500" />
+      <DefaultRolloverStrategy compressionLevel="9" />
+    </RollingFile>
+    <List name="List">
+      <ThresholdFilter level="error"/>
+    </List>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <ThreadContextMapFilter>
+        <KeyValuePair key="test" value="123"/>
+      </ThreadContextMapFilter>
+      <AppenderRef ref="STDOUT"/>
+    </Logger>>
+
+    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
+      <AppenderRef ref="RollingFile"/>
+    </Logger>>
+
+    <Root level="error">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a82794f0/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 675a24a..36bb642 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -67,7 +67,10 @@
         Properties declared in configuration can now have their value either in the element body or in an attribute named "value".
       </action>
       <action issue="LOG4J2-1501" dev="ggregory" type="add" due-to="Gary Gregory">
-        FileAppender should be able to create files lazily.
+        FileAppender should be able to create files on-demand.
+      </action>
+      <action issue="LOG4J2-1504" dev="ggregory" type="add" due-to="Gary Gregory">
+        RollingFileAppender should be able to create files on-demand.
       </action>
       <action issue="LOG4J2-1471" dev="ggregory" type="add" due-to="Gary Gregory">
         [PatternLayout] Add an ANSI option to %xThrowable.


[15/24] logging-log4j2 git commit: Remove unused import.

Posted by mi...@apache.org.
Remove unused import.

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

Branch: refs/heads/LOG4J2-1528
Commit: 1aa3c3e249c5d9727fc784aff094a3da222df809
Parents: 4f793c0
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 17:18:01 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 17:18:01 2016 -0700

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/util/Log4jThreadFactory.java     | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1aa3c3e2/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java
index ed07056..333ca0a 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Log4jThreadFactory.java
@@ -20,8 +20,6 @@ package org.apache.logging.log4j.core.util;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.logging.log4j.util.Strings;
-
 /**
  * Creates {@link Log4jThreads}.
  * 


[21/24] logging-log4j2 git commit: [LOG4J2-1504] RollingFileAppender should be able to create files on-demand.

Posted by mi...@apache.org.
[LOG4J2-1504] RollingFileAppender should be able to create files
on-demand.

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

Branch: refs/heads/LOG4J2-1528
Commit: 2f34ba3112798868b4c6f1ba48a2bcbd922cb8c1
Parents: 779e542
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 22:30:41 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 22:30:41 2016 -0700

----------------------------------------------------------------------
 src/site/xdoc/manual/appenders.xml | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2f34ba31/src/site/xdoc/manual/appenders.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/appenders.xml b/src/site/xdoc/manual/appenders.xml
index 7166087..5df7d99 100644
--- a/src/site/xdoc/manual/appenders.xml
+++ b/src/site/xdoc/manual/appenders.xml
@@ -2131,6 +2131,12 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity {
               <td>When bufferedIO is true, this is the buffer size, the default is 8192 bytes.</td>
             </tr>
             <tr>
+              <td>createOnDemand</td>
+              <td>boolean</td>
+              <td>The appender creates the file on-demand. The appender only creates the file when a log event 
+                passes all filters and is routed to this appender.</td>
+            </tr>
+            <tr>
               <td>filter</td>
               <td>Filter</td>
               <td>A Filter to determine if the event should be handled by this Appender. More than one Filter


[17/24] logging-log4j2 git commit: Comment empty blocks.

Posted by mi...@apache.org.
Comment empty blocks.

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

Branch: refs/heads/LOG4J2-1528
Commit: 9bc3195a99a55c0d6bdcac70c06abbbff2fb1d6c
Parents: f1b61bd
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 17:33:16 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 17:33:16 2016 -0700

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/appender/AbstractManager.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9bc3195a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
index 9c67f24..4c78e7f 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
@@ -87,6 +87,7 @@ public abstract class AbstractManager {
     }
 
     public void updateData(final Object data) {
+        // This default implementation does nothing.
     }
 
     /**
@@ -108,6 +109,7 @@ public abstract class AbstractManager {
      * lock is held.
      */
     protected void releaseSub() {
+        // This default implementation does nothing.
     }
 
     protected int getCount() {


[20/24] logging-log4j2 git commit: [OG4J2-1501] ileAppender should be able to create files on-demand.

Posted by mi...@apache.org.
[OG4J2-1501] ileAppender should be able to create files on-demand.

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

Branch: refs/heads/LOG4J2-1528
Commit: 779e542f7c3bddfc54bf48668b0a74ad5120dd7f
Parents: 1967ac1
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 22:29:26 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 22:29:26 2016 -0700

----------------------------------------------------------------------
 src/site/xdoc/manual/appenders.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/779e542f/src/site/xdoc/manual/appenders.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/appenders.xml b/src/site/xdoc/manual/appenders.xml
index 7263116..7166087 100644
--- a/src/site/xdoc/manual/appenders.xml
+++ b/src/site/xdoc/manual/appenders.xml
@@ -384,7 +384,7 @@
                 of "%m%n" will be used.</td>
             </tr>
             <tr>
-              <td>lazyCreate</td>
+              <td>createOnDemand</td>
               <td>boolean</td>
               <td>The appender creates the file on-demand. The appender only creates the file when a log event 
                 passes all filters and is routed to this appender.</td>


[18/24] logging-log4j2 git commit: Javadoc: Add missing tags.

Posted by mi...@apache.org.
Javadoc: Add missing tags.

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

Branch: refs/heads/LOG4J2-1528
Commit: f89e9757ab5e54a42ce08e8533f3f94cf58b6b4e
Parents: 9bc3195
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 17:35:29 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 17:35:29 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/Logger.java   | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f89e9757/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java b/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
index 030c0a6..d38af94 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java
@@ -2713,6 +2713,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2722,6 +2723,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2732,6 +2734,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2743,6 +2746,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2755,6 +2759,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2768,6 +2773,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2782,6 +2788,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2798,6 +2805,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2815,6 +2823,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2833,6 +2842,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param marker the marker data specific to this log statement
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
@@ -2852,6 +2862,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      */
@@ -2860,6 +2871,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.
@@ -2869,6 +2881,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.
@@ -2879,6 +2892,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.
@@ -2890,6 +2904,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.
@@ -2902,6 +2917,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.
@@ -2915,6 +2931,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.
@@ -2929,6 +2946,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.
@@ -2944,6 +2962,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.
@@ -2961,6 +2980,7 @@ public interface Logger {
     /**
      * Logs a message with parameters at the specified level.
      *
+     * @param level the logging level
      * @param message the message to log; the format depends on the message factory.
      * @param p0 parameter to the message.
      * @param p1 parameter to the message.


[19/24] logging-log4j2 git commit: Add @SuppressWarnings.

Posted by mi...@apache.org.
Add @SuppressWarnings.

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

Branch: refs/heads/LOG4J2-1528
Commit: 1967ac1575f3249814649842968e1ef839762815
Parents: f89e975
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 17:37:04 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 17:37:04 2016 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/logging/log4j/core/LoggerContext.java  | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1967ac15/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
index 63073e6..cfb4945 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
@@ -259,6 +259,7 @@ public class LoggerContext extends AbstractLifeCycle
                     this.shutdownCallback = ((ShutdownCallbackRegistry) factory).addShutdownCallback(new Runnable() {
                         @Override
                         public void run() {
+                            @SuppressWarnings("resource")
                             final LoggerContext context = LoggerContext.this;
                             LOGGER.debug(SHUTDOWN_HOOK_MARKER, "Stopping LoggerContext[name={}, {}]",
                                     context.getName(), context);


[10/24] logging-log4j2 git commit: Fix attributes not being merged in composite configurations

Posted by mi...@apache.org.
Fix attributes not being merged in composite configurations

LOG4J2-1529


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

Branch: refs/heads/LOG4J2-1528
Commit: dbe8c3abce06c07a93c071e7d87c5ce6ce1a28c2
Parents: f6dc776
Author: Matt Sicker <bo...@gmail.com>
Authored: Fri Aug 19 20:48:48 2016 -0500
Committer: Matt Sicker <bo...@gmail.com>
Committed: Fri Aug 19 20:48:58 2016 -0500

----------------------------------------------------------------------
 .../config/composite/DefaultMergeStrategy.java  |  1 +
 .../core/config/CompositeConfigurationTest.java | 34 +++++++++++++--
 .../log4j-comp-logger-attr-override.json        | 38 +++++++++++++++++
 .../test/resources/log4j-comp-logger-root.xml   | 44 ++++++++++++++++++++
 src/changes/changes.xml                         |  4 +-
 5 files changed, 116 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dbe8c3ab/log4j-core/src/main/java/org/apache/logging/log4j/core/config/composite/DefaultMergeStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/composite/DefaultMergeStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/composite/DefaultMergeStrategy.java
index c799e1d..9eccdf5 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/composite/DefaultMergeStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/composite/DefaultMergeStrategy.java
@@ -155,6 +155,7 @@ public class DefaultMergeStrategy implements MergeStrategy {
                             final Node targetNode = getLoggerNode(targetChildNode, node.getAttributes().get(NAME));
                             final Node loggerNode = new Node(targetChildNode, node.getName(), node.getType());
                             if (targetNode != null) {
+                                targetNode.getAttributes().putAll(node.getAttributes());
                                 for (final Node sourceLoggerChild : node.getChildren()) {
                                     if (isFilterNode(sourceLoggerChild)) {
                                         boolean foundFilter = false;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dbe8c3ab/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CompositeConfigurationTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CompositeConfigurationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CompositeConfigurationTest.java
index 8482cf4..1e78cac 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CompositeConfigurationTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CompositeConfigurationTest.java
@@ -16,12 +16,9 @@
  */
 package org.apache.logging.log4j.core.config;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 import java.util.Map;
 
+import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.appender.ConsoleAppender;
 import org.apache.logging.log4j.core.appender.FileAppender;
@@ -32,6 +29,8 @@ import org.junit.Test;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
 
+import static org.junit.Assert.*;
+
 public class CompositeConfigurationTest {
 /*
     @Test
@@ -129,6 +128,33 @@ public class CompositeConfigurationTest {
         };
         runTest(lcr, test);
     }
+
+    @Test
+    public void testAttributeMergeForLoggers() {
+        final LoggerContextRule lcr = new LoggerContextRule("classpath:log4j-comp-logger-root.xml,log4j-comp-logger-attr-override.json");
+        final Statement test = new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                final CompositeConfiguration config = (CompositeConfiguration) lcr.getConfiguration();
+                //Test for Root log level override
+                assertEquals("Expected Root logger log level to be WARN", Level.WARN, config.getRootLogger().getLevel());
+
+                //Test for cat2 level override
+                LoggerConfig cat2 = config.getLogger("cat2");
+                assertEquals("Expected cat2 log level to be INFO", Level.INFO, cat2.getLevel());
+
+                //Test for cat2 additivity override
+                assertTrue("Expected cat2 additivity to be true", cat2.isAdditive());
+
+                //Regression
+                //Check level on cat3 (not present in root config)
+                assertEquals("Expected cat3 log level to be ERROR", Level.ERROR, config.getLogger("cat3").getLevel());
+                //Check level on cat1 (not present in overriden config)
+                assertEquals("Expected cat1 log level to be DEBUG", Level.DEBUG, config.getLogger("cat1").getLevel());
+            }
+        };
+        runTest(lcr, test);
+    }
 /*
     @Test
     public void overrideFilter() {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dbe8c3ab/log4j-core/src/test/resources/log4j-comp-logger-attr-override.json
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-comp-logger-attr-override.json b/log4j-core/src/test/resources/log4j-comp-logger-attr-override.json
new file mode 100644
index 0000000..a6e28aa
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-comp-logger-attr-override.json
@@ -0,0 +1,38 @@
+{
+    "Configuration" : {
+        "status": "error",
+        "name": "LoggerConfigTest",
+        "properties" : {
+          "property" : [{
+            "name" : "filename",
+            "value": "target/composite.log"
+           }]
+        },
+        "Loggers" : {
+            "logger" : [
+                {
+                    "name" : "cat2",
+                    "level" : "info",
+                    "additivity" : true,
+                    "AppenderRef" : {
+                        "ref" : "File"
+                    }
+
+                },
+                {
+                    "name" : "cat3",
+                    "level" : "error",
+                    "AppenderRef" : {
+                        "ref" : "STDOUT"
+                    }
+                }
+            ],
+            "Root" : {
+                "level" : "warn",
+                "AppenderRef" : [{
+                    "ref" : "File"
+                }]
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dbe8c3ab/log4j-core/src/test/resources/log4j-comp-logger-root.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-comp-logger-root.xml b/log4j-core/src/test/resources/log4j-comp-logger-root.xml
new file mode 100644
index 0000000..dcf2605
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-comp-logger-root.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="ERROR" name="LoggerConfigTest">
+    <Appenders>
+        <Console name="STDOUT">
+            <PatternLayout pattern="%m%n"/>
+        </Console>
+        <File name="File" fileName="${filename}" bufferedIO="false">
+            <PatternLayout>
+                <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+            </PatternLayout>
+        </File>
+    </Appenders>
+
+    <Loggers>
+        <Logger name="cat1" level="debug" additivity="false">
+            <AppenderRef ref="File"/>
+        </Logger>
+
+        <Logger name="cat2" level="debug" additivity="false">
+            <AppenderRef ref="File"/>
+        </Logger>
+        <Root>
+            <AppenderRef ref="STDOUT" />
+        </Root>
+    </Loggers>
+
+</Configuration>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dbe8c3ab/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6664fde..767e097 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,7 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
-
+      <action issue="LOG4J2-1529" dev="mattsicker" type="fix" due-to="Sridevi Narra">
+        Attributes are not merged properly in composite configurations.
+      </action>
       <action issue="LOG4J2-1527" dev="rpopma" type="fix" due-to="Jose Leon">
         Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications.
       </action>


[06/24] logging-log4j2 git commit: Replace "lazyCreate" with "createOnDemand".

Posted by mi...@apache.org.
Replace "lazyCreate" with "createOnDemand".

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

Branch: refs/heads/LOG4J2-1528
Commit: 4e5ef989c3126276f752435e91c6f7ea5ad0a52d
Parents: b3d6a39
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Aug 19 18:10:27 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Aug 19 18:10:27 2016 -0700

----------------------------------------------------------------------
 .../log4j/core/appender/FileAppender.java       | 12 ++---
 .../log4j/core/appender/FileManager.java        | 32 ++++++-------
 .../core/appender/OutputStreamManager.java      |  4 +-
 .../core/appender/RollingFileAppender.java      | 14 +++---
 .../appender/rolling/RollingFileManager.java    | 26 +++++------
 .../log4j/core/appender/FileAppenderTest.java   | 48 ++++++++++----------
 .../rolling/RollingAppenderSizeTest.java        | 38 ++++++++--------
 .../test/resources/log4j-rolling-7z-lazy.xml    |  2 +-
 .../test/resources/log4j-rolling-bzip2-lazy.xml |  2 +-
 .../resources/log4j-rolling-deflate-lazy.xml    |  2 +-
 .../test/resources/log4j-rolling-gz-lazy.xml    |  2 +-
 .../resources/log4j-rolling-pack200-lazy.xml    |  2 +-
 .../test/resources/log4j-rolling-xz-lazy.xml    |  2 +-
 .../test/resources/log4j-rolling-zip-lazy.xml   |  2 +-
 14 files changed, 94 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
index e93e05f..5c8eff4 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
@@ -70,7 +70,7 @@ public final class FileAppender extends AbstractOutputStreamAppender<FileManager
         private String advertiseUri;
 
         @PluginBuilderAttribute
-        private boolean lazyCreate;
+        private boolean createOnDemand;
 
         @PluginConfiguration
         private Configuration config;
@@ -86,7 +86,7 @@ public final class FileAppender extends AbstractOutputStreamAppender<FileManager
             }
             Layout<? extends Serializable> layout = getOrCreateLayout();
 
-            final FileManager manager = FileManager.getFileManager(fileName, append, locking, bufferedIo, lazyCreate,
+            final FileManager manager = FileManager.getFileManager(fileName, append, locking, bufferedIo, createOnDemand,
                     advertiseUri, layout, bufferSize, isImmediateFlush());
             if (manager == null) {
                 return null;
@@ -124,8 +124,8 @@ public final class FileAppender extends AbstractOutputStreamAppender<FileManager
             return bufferedIo;
         }
 
-        public boolean isLazyCreate() {
-            return lazyCreate;
+        public boolean isCreateOnDemand() {
+            return createOnDemand;
         }
 
         public boolean isLocking() {
@@ -167,8 +167,8 @@ public final class FileAppender extends AbstractOutputStreamAppender<FileManager
             return asBuilder();
         }
 
-        public B withLazyCreate(final boolean lazyCreate) {
-            this.lazyCreate = lazyCreate;
+        public B withCreateOnDemand(final boolean createOnDemand) {
+            this.createOnDemand = createOnDemand;
             return asBuilder();
         }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java
index b8a559a..2b9024b 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FileManager.java
@@ -40,7 +40,7 @@ public class FileManager extends OutputStreamManager {
     private static final FileManagerFactory FACTORY = new FileManagerFactory();
 
     private final boolean isAppend;
-    private final boolean isLazyCreate;
+    private final boolean createOnDemand;
     private final boolean isLocking;
     private final String advertiseURI;
     private final int bufferSize;
@@ -65,7 +65,7 @@ public class FileManager extends OutputStreamManager {
             final ByteBuffer buffer) {
         super(os, fileName, layout, writeHeader, buffer);
         this.isAppend = append;
-        this.isLazyCreate = false;
+        this.createOnDemand = false;
         this.isLocking = locking;
         this.advertiseURI = advertiseURI;
         this.bufferSize = buffer.capacity();
@@ -75,12 +75,12 @@ public class FileManager extends OutputStreamManager {
      * @throws IOException 
      * @since 2.7 
      */
-    protected FileManager(final String fileName, final OutputStream os, final boolean append, final boolean locking, final boolean lazyCreate,
+    protected FileManager(final String fileName, final OutputStream os, final boolean append, final boolean locking, final boolean createOnDemand,
             final String advertiseURI, final Layout<? extends Serializable> layout, final boolean writeHeader,
             final ByteBuffer buffer) throws IOException {
-        super(os, fileName, lazyCreate, layout, writeHeader, buffer);
+        super(os, fileName, createOnDemand, layout, writeHeader, buffer);
         this.isAppend = append;
-        this.isLazyCreate = lazyCreate;
+        this.createOnDemand = createOnDemand;
         this.isLocking = locking;
         this.advertiseURI = advertiseURI;
         this.bufferSize = buffer.capacity();
@@ -92,7 +92,7 @@ public class FileManager extends OutputStreamManager {
      * @param append true if the file should be appended to, false if it should be overwritten.
      * @param locking true if the file should be locked while writing, false otherwise.
      * @param bufferedIo true if the contents should be buffered as they are written.
-     * @param lazyCreate true if you want to lazy-create the file (a.k.a. on-demand.)
+     * @param createOnDemand true if you want to lazy-create the file (a.k.a. on-demand.)
      * @param advertiseUri the URI to use when advertising the file
      * @param layout The layout
      * @param bufferSize buffer size for buffered IO
@@ -100,14 +100,14 @@ public class FileManager extends OutputStreamManager {
      * @return A FileManager for the File.
      */
     public static FileManager getFileManager(final String fileName, final boolean append, boolean locking,
-            final boolean bufferedIo, final boolean lazyCreate, final String advertiseUri,
+            final boolean bufferedIo, final boolean createOnDemand, final String advertiseUri,
             final Layout<? extends Serializable> layout, final int bufferSize, final boolean immediateFlush) {
 
         if (locking && bufferedIo) {
             locking = false;
         }
         return (FileManager) getManager(fileName,
-                new FactoryData(append, locking, bufferedIo, bufferSize, immediateFlush, lazyCreate, advertiseUri, layout),
+                new FactoryData(append, locking, bufferedIo, bufferSize, immediateFlush, createOnDemand, advertiseUri, layout),
                 FACTORY);
     }
 
@@ -162,8 +162,8 @@ public class FileManager extends OutputStreamManager {
      * Returns the lazy-create.
      * @return true if the file will be lazy-created.
      */
-    public boolean isLazyCreate() {
-        return isLazyCreate;
+    public boolean isCreateOnDemand() {
+        return createOnDemand;
     }
 
     /**
@@ -204,7 +204,7 @@ public class FileManager extends OutputStreamManager {
         private final boolean bufferedIO;
         private final int bufferSize;
         private final boolean immediateFlush;
-        private final boolean lazyCreate;
+        private final boolean createOnDemand;
         private final String advertiseURI;
         private final Layout<? extends Serializable> layout;
 
@@ -215,19 +215,19 @@ public class FileManager extends OutputStreamManager {
          * @param bufferedIO Buffering flag.
          * @param bufferSize Buffer size.
          * @param immediateFlush flush on every write or not
-         * @param lazyCreate if you want to lazy-create the file (a.k.a. on-demand.)
+         * @param createOnDemand if you want to lazy-create the file (a.k.a. on-demand.)
          * @param advertiseURI the URI to use when advertising the file
          * @param layout The layout
          */
         public FactoryData(final boolean append, final boolean locking, final boolean bufferedIO, final int bufferSize,
-                final boolean immediateFlush, final boolean lazyCreate, final String advertiseURI,
+                final boolean immediateFlush, final boolean createOnDemand, final String advertiseURI,
                 final Layout<? extends Serializable> layout) {
             this.append = append;
             this.locking = locking;
             this.bufferedIO = bufferedIO;
             this.bufferSize = bufferSize;
             this.immediateFlush = immediateFlush;
-            this.lazyCreate = lazyCreate;
+            this.createOnDemand = createOnDemand;
             this.advertiseURI = advertiseURI;
             this.layout = layout;
         }
@@ -256,8 +256,8 @@ public class FileManager extends OutputStreamManager {
             try {
                 final int actualSize = data.bufferedIO ? data.bufferSize : Constants.ENCODER_BYTE_BUFFER_SIZE;
                 final ByteBuffer buffer = ByteBuffer.wrap(new byte[actualSize]);
-                final FileOutputStream fos = data.lazyCreate ? null : new FileOutputStream(file, data.append);
-                return new FileManager(name, fos, data.append, data.locking, data.lazyCreate, data.advertiseURI, data.layout,
+                final FileOutputStream fos = data.createOnDemand ? null : new FileOutputStream(file, data.append);
+                return new FileManager(name, fos, data.append, data.locking, data.createOnDemand, data.advertiseURI, data.layout,
                         writeHeader, buffer);
             } catch (final IOException ex) {
                 LOGGER.error("FileManager (" + name + ") " + ex, ex);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
index d895dd5..e5960ee 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
@@ -69,11 +69,11 @@ public class OutputStreamManager extends AbstractManager implements ByteBufferDe
      * @throws IOException 
      * @since 2.7
      */
-    protected OutputStreamManager(OutputStream os, final String streamName, final boolean lazyCreate,
+    protected OutputStreamManager(OutputStream os, final String streamName, final boolean createOnDemand,
             final Layout<? extends Serializable> layout, final boolean writeHeader, final ByteBuffer byteBuffer)
             throws IOException {
         super(streamName);
-        if (lazyCreate && os != null) {
+        if (createOnDemand && os != null) {
             LOGGER.error(
                     "Invalid OutputStreamManager configuration for '{}': You cannot both set the OutputStream and request on-demand.",
                     streamName);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
index dc830e3..fcef0d6 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
@@ -91,7 +91,7 @@ public final class RollingFileAppender extends AbstractOutputStreamAppender<Roll
         private String advertiseUri;
 
         @PluginBuilderAttribute
-        private boolean lazyCreate;
+        private boolean createOnDemand;
 
         @PluginConfiguration
         private Configuration config;
@@ -136,7 +136,7 @@ public final class RollingFileAppender extends AbstractOutputStreamAppender<Roll
 
             final RollingFileManager manager = RollingFileManager.getFileManager(fileName, filePattern, append,
                     bufferedIo, policy, strategy, advertiseUri, getLayout(), bufferSize, isImmediateFlush(),
-                    lazyCreate);
+                    createOnDemand);
             if (manager == null) {
                 return null;
             }
@@ -175,8 +175,8 @@ public final class RollingFileAppender extends AbstractOutputStreamAppender<Roll
             return bufferedIo;
         }
 
-        public boolean isLazyCreate() {
-            return lazyCreate;
+        public boolean isCreateOnDemand() {
+            return createOnDemand;
         }
 
         public boolean isLocking() {
@@ -218,8 +218,8 @@ public final class RollingFileAppender extends AbstractOutputStreamAppender<Roll
             return asBuilder();
         }
 
-        public B withLazyCreate(final boolean lazyCreate) {
-            this.lazyCreate = lazyCreate;
+        public B withCreateOnDemand(final boolean createOnDemand) {
+            this.createOnDemand = createOnDemand;
             return asBuilder();
         }
 
@@ -379,7 +379,7 @@ public final class RollingFileAppender extends AbstractOutputStreamAppender<Roll
                 .withIgnoreExceptions(Booleans.parseBoolean(ignore, true))
                 .withImmediateFlush(Booleans.parseBoolean(immediateFlush, true))
                 .withLayout(layout)
-                .withLazyCreate(false)
+                .withCreateOnDemand(false)
                 .withLocking(false)
                 .withName(name)
                 .withPolicy(policy)

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
index 5f390f1..3c6739f 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
@@ -85,11 +85,11 @@ public class RollingFileManager extends FileManager {
      * @since 2.7
      */
     protected RollingFileManager(final String fileName, final String pattern, final OutputStream os, final boolean append,
-            final boolean lazyCreate, final long size, final long time, final TriggeringPolicy triggeringPolicy,
+            final boolean createOnDemand, final long size, final long time, final TriggeringPolicy triggeringPolicy,
             final RolloverStrategy rolloverStrategy, final String advertiseURI,
             final Layout<? extends Serializable> layout, final boolean writeHeader, final ByteBuffer buffer)
             throws IOException {
-        super(fileName, os, append, false, lazyCreate, advertiseURI, layout, writeHeader, buffer);
+        super(fileName, os, append, false, createOnDemand, advertiseURI, layout, writeHeader, buffer);
         this.size = size;
         this.initialTime = time;
         this.triggeringPolicy = triggeringPolicy;
@@ -114,16 +114,16 @@ public class RollingFileManager extends FileManager {
      * @param layout The Layout.
      * @param bufferSize buffer size to use if bufferedIO is true
      * @param immediateFlush flush on every write or not
-     * @param lazyCreate true if you want to lazy-create the file (a.k.a. on-demand.)
+     * @param createOnDemand true if you want to lazy-create the file (a.k.a. on-demand.)
      * @return A RollingFileManager.
      */
     public static RollingFileManager getFileManager(final String fileName, final String pattern, final boolean append,
             final boolean bufferedIO, final TriggeringPolicy policy, final RolloverStrategy strategy,
             final String advertiseURI, final Layout<? extends Serializable> layout, final int bufferSize,
-            final boolean immediateFlush, final boolean lazyCreate) {
+            final boolean immediateFlush, final boolean createOnDemand) {
 
         return (RollingFileManager) getManager(fileName, new FactoryData(pattern, append,
-            bufferedIO, policy, strategy, advertiseURI, layout, bufferSize, immediateFlush, lazyCreate), factory);
+            bufferedIO, policy, strategy, advertiseURI, layout, bufferSize, immediateFlush, createOnDemand), factory);
     }
 
     // override to make visible for unit tests
@@ -347,7 +347,7 @@ public class RollingFileManager extends FileManager {
         private final boolean bufferedIO;
         private final int bufferSize;
         private final boolean immediateFlush;
-        private final boolean lazyCreate;
+        private final boolean createOnDemand;
         private final TriggeringPolicy policy;
         private final RolloverStrategy strategy;
         private final String advertiseURI;
@@ -362,12 +362,12 @@ public class RollingFileManager extends FileManager {
          * @param layout The Layout.
          * @param bufferSize the buffer size
          * @param immediateFlush flush on every write or not
-         * @param lazyCreate true if you want to lazy-create the file (a.k.a. on-demand.)
+         * @param createOnDemand true if you want to lazy-create the file (a.k.a. on-demand.)
          */
         public FactoryData(final String pattern, final boolean append, final boolean bufferedIO,
                 final TriggeringPolicy policy, final RolloverStrategy strategy, final String advertiseURI,
                 final Layout<? extends Serializable> layout, final int bufferSize, final boolean immediateFlush, 
-                final boolean lazyCreate) {
+                final boolean createOnDemand) {
             this.pattern = pattern;
             this.append = append;
             this.bufferedIO = bufferedIO;
@@ -377,7 +377,7 @@ public class RollingFileManager extends FileManager {
             this.advertiseURI = advertiseURI;
             this.layout = layout;
             this.immediateFlush = immediateFlush;
-            this.lazyCreate = lazyCreate;
+            this.createOnDemand = createOnDemand;
         }
 
         public TriggeringPolicy getTriggeringPolicy()
@@ -444,7 +444,7 @@ public class RollingFileManager extends FileManager {
             // LOG4J2-1140: check writeHeader before creating the file
             final boolean writeHeader = !data.append || !file.exists();
             try {
-                final boolean created = data.lazyCreate ? false : file.createNewFile();
+                final boolean created = data.createOnDemand ? false : file.createNewFile();
                 LOGGER.trace("New file '{}' created = {}", name, created);
             } catch (final IOException ioe) {
                 LOGGER.error("Unable to create file " + name, ioe);
@@ -455,10 +455,10 @@ public class RollingFileManager extends FileManager {
             try {
                 final int actualSize = data.bufferedIO ? data.bufferSize : Constants.ENCODER_BYTE_BUFFER_SIZE;
                 final ByteBuffer buffer = ByteBuffer.wrap(new byte[actualSize]);
-                final OutputStream os = data.lazyCreate ? null : new FileOutputStream(name, data.append);
-                final long time = data.lazyCreate? System.currentTimeMillis() : file.lastModified(); // LOG4J2-531 create file first so time has valid value
+                final OutputStream os = data.createOnDemand ? null : new FileOutputStream(name, data.append);
+                final long time = data.createOnDemand? System.currentTimeMillis() : file.lastModified(); // LOG4J2-531 create file first so time has valid value
                 
-                return new RollingFileManager(name, data.pattern, os, data.append, data.lazyCreate, size, time, data.policy,
+                return new RollingFileManager(name, data.pattern, os, data.append, data.createOnDemand, size, time, data.policy,
                         data.strategy, data.advertiseURI, data.layout, writeHeader, buffer);
             } catch (final IOException ex) {
                 LOGGER.error("RollingFileManager (" + name + ") " + ex, ex);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
index feb9f11..0ffb9a0 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
@@ -55,7 +55,7 @@ import org.junit.runners.Parameterized.Parameters;
 @RunWith(Parameterized.class)
 public class FileAppenderTest {
 
-    @Parameters(name = "lazyCreate = {0}")
+    @Parameters(name = "createOnDemand = {0}")
     public static Boolean[] getParameters() {
         return new Boolean[] { false, true };
     }
@@ -64,12 +64,12 @@ public class FileAppenderTest {
     private static final Path PATH = Paths.get(FILE_NAME);
     private static final int THREADS = 2;
 
-    public FileAppenderTest(boolean lazyCreate) {
+    public FileAppenderTest(boolean createOnDemand) {
         super();
-        this.lazyCreate = lazyCreate;
+        this.createOnDemand = createOnDemand;
     }
 
-    private final boolean lazyCreate;
+    private final boolean createOnDemand;
     private final int threadCount = THREADS;
 
     @Rule
@@ -83,7 +83,7 @@ public class FileAppenderTest {
     @Test
     public void testAppender() throws Exception {
         final int logEventCount = 1;
-        writer(false, logEventCount, "test", lazyCreate, false);
+        writer(false, logEventCount, "test", createOnDemand, false);
         verifyFile(logEventCount);
     }
 
@@ -99,18 +99,18 @@ public class FileAppenderTest {
             .withBufferedIo(false)
             .withBufferSize(1)
             .withLayout(layout)
-            .withLazyCreate(lazyCreate)
+            .withCreateOnDemand(createOnDemand)
             .build();
         // @formatter:on
-        Assert.assertEquals(lazyCreate, appender.getManager().isLazyCreate());
+        Assert.assertEquals(createOnDemand, appender.getManager().isCreateOnDemand());
         try {
-            Assert.assertNotEquals(lazyCreate, Files.exists(PATH));
+            Assert.assertNotEquals(createOnDemand, Files.exists(PATH));
             appender.start();
-            Assert.assertNotEquals(lazyCreate, Files.exists(PATH));
+            Assert.assertNotEquals(createOnDemand, Files.exists(PATH));
         } finally {
             appender.stop();
         }
-        Assert.assertNotEquals(lazyCreate, Files.exists(PATH));
+        Assert.assertNotEquals(createOnDemand, Files.exists(PATH));
     }
 
     private static PatternLayout createPatternLayout() {
@@ -130,14 +130,14 @@ public class FileAppenderTest {
             .withBufferedIo(false)
             .withBufferSize(1)
             .withLayout(layout)
-            .withLazyCreate(lazyCreate)
+            .withCreateOnDemand(createOnDemand)
             .build();
         // @formatter:on
         try {
             appender.start();
             final File file = new File(FILE_NAME);
             assertTrue("Appender did not start", appender.isStarted());
-            Assert.assertNotEquals(lazyCreate, Files.exists(PATH));
+            Assert.assertNotEquals(createOnDemand, Files.exists(PATH));
             long curLen = file.length();
             long prevLen = curLen;
             assertTrue("File length: " + curLen, curLen == 0);
@@ -166,7 +166,7 @@ public class FileAppenderTest {
     @Test
     public void testLockingAppender() throws Exception {
         final int logEventCount = 1;
-        writer(true, logEventCount, "test", lazyCreate, false);
+        writer(true, logEventCount, "test", createOnDemand, false);
         verifyFile(logEventCount);
     }
 
@@ -208,7 +208,7 @@ public class FileAppenderTest {
         final ProcessBuilder[] builders = new ProcessBuilder[processCount];
         for (int index = 0; index < processCount; ++index) {
             builders[index] = new ProcessBuilder("java", "-cp", classPath, ProcessTest.class.getName(),
-                    "Process " + index, logEventCount.toString(), "true", Boolean.toString(lazyCreate));
+                    "Process " + index, logEventCount.toString(), "true", Boolean.toString(createOnDemand));
         }
         for (int index = 0; index < processCount; ++index) {
             processes[index] = builders[index].start();
@@ -227,7 +227,7 @@ public class FileAppenderTest {
         verifyFile(logEventCount * processCount);
     }
 
-    private static void writer(final boolean locking, final int logEventCount, final String name, boolean lazyCreate,
+    private static void writer(final boolean locking, final int logEventCount, final String name, boolean createOnDemand,
             boolean concurrent) throws Exception {
         final Layout<String> layout = createPatternLayout();
         // @formatter:off
@@ -239,23 +239,23 @@ public class FileAppenderTest {
             .withLocking(locking)
             .withBufferedIo(false)
             .withLayout(layout)
-            .withLazyCreate(lazyCreate)
+            .withCreateOnDemand(createOnDemand)
             .build();
         // @formatter:on
-        Assert.assertEquals(lazyCreate, appender.getManager().isLazyCreate());
+        Assert.assertEquals(createOnDemand, appender.getManager().isCreateOnDemand());
         try {
             appender.start();
             assertTrue("Appender did not start", appender.isStarted());
             final boolean exists = Files.exists(PATH);
-            String msg = String.format("concurrent = %s, lazyCreate = %s, file exists = %s", concurrent, lazyCreate,
+            String msg = String.format("concurrent = %s, createOnDemand = %s, file exists = %s", concurrent, createOnDemand,
                     exists);
             // If concurrent the file might have been created (or not.)
-            // Can't really test lazyCreate && concurrent.
-            final boolean expectFileCreated = !lazyCreate;
+            // Can't really test createOnDemand && concurrent.
+            final boolean expectFileCreated = !createOnDemand;
             if (concurrent && expectFileCreated) {
                 Assert.assertTrue(msg, exists);
             } else if (expectFileCreated) {
-                Assert.assertNotEquals(msg, lazyCreate, exists);
+                Assert.assertNotEquals(msg, createOnDemand, exists);
             }
             for (int i = 0; i < logEventCount; ++i) {
                 final LogEvent logEvent = Log4jLogEvent.newBuilder().setLoggerName("TestLogger")
@@ -310,7 +310,7 @@ public class FileAppenderTest {
             final Thread thread = Thread.currentThread();
 
             try {
-                writer(lock, logEventCount, thread.getName(), lazyCreate, true);
+                writer(lock, logEventCount, thread.getName(), createOnDemand, true);
             } catch (final Exception ex) {
                 exceptionRef[0] = ex;
                 throw new RuntimeException(ex);
@@ -336,12 +336,12 @@ public class FileAppenderTest {
             }
             final boolean lock = Boolean.parseBoolean(args[2]);
 
-            final boolean lazyCreate = Boolean.parseBoolean(args[2]);
+            final boolean createOnDemand = Boolean.parseBoolean(args[2]);
 
             // System.out.println("Got arguments " + id + ", " + count + ", " + lock);
 
             try {
-                writer(lock, count, id, lazyCreate, true);
+                writer(lock, count, id, createOnDemand, true);
                 // thread.sleep(50);
 
             } catch (final Exception ex) {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
index 0560301..d354b41 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
@@ -66,34 +66,34 @@ public class RollingAppenderSizeTest {
 
     private Logger logger;
 
-    private final boolean lazyCreate;
+    private final boolean createOnDemand;
 
-    @Parameterized.Parameters(name = "{0} \u2192 {1} (lazyCreate = {2})")
+    @Parameterized.Parameters(name = "{0} \u2192 {1} (createOnDemand = {2})")
     public static Collection<Object[]> data() {
         return Arrays.asList(new Object[][] { //
                 // @formatter:off
-               {"log4j-rolling-gz-lazy.xml", ".gz", true}, //
-               {"log4j-rolling-gz.xml", ".gz", false}, //
-               {"log4j-rolling-zip-lazy.xml", ".zip", true}, //
-               {"log4j-rolling-zip.xml", ".zip", false}, //
+               {"log4j-rolling-gz-lazy.xml", ".gz", true},
+               {"log4j-rolling-gz.xml", ".gz", false},
+               {"log4j-rolling-zip-lazy.xml", ".zip", true},
+               {"log4j-rolling-zip.xml", ".zip", false},
                 // Apache Commons Compress
-               {"log4j-rolling-bzip2-lazy.xml", ".bz2", true}, //
-               {"log4j-rolling-bzip2.xml", ".bz2", false}, //
-               {"log4j-rolling-deflate-lazy.xml", ".deflate", true}, //
-               {"log4j-rolling-deflate.xml", ".deflate", false}, //
-               {"log4j-rolling-pack200-lazy.xml", ".pack200", true}, //
-               {"log4j-rolling-pack200.xml", ".pack200", false}, //
-               {"log4j-rolling-xz-lazy.xml", ".xz", true}, //
-               {"log4j-rolling-xz.xml", ".xz", false}, //
+               {"log4j-rolling-bzip2-lazy.xml", ".bz2", true},
+               {"log4j-rolling-bzip2.xml", ".bz2", false},
+               {"log4j-rolling-deflate-lazy.xml", ".deflate", true},
+               {"log4j-rolling-deflate.xml", ".deflate", false},
+               {"log4j-rolling-pack200-lazy.xml", ".pack200", true},
+               {"log4j-rolling-pack200.xml", ".pack200", false},
+               {"log4j-rolling-xz-lazy.xml", ".xz", true},
+               {"log4j-rolling-xz.xml", ".xz", false},
                 });
                 // @formatter:on
     }
 
     private LoggerContextRule loggerContextRule;
 
-    public RollingAppenderSizeTest(final String configFile, final String fileExtension, final boolean lazyCreate) {
+    public RollingAppenderSizeTest(final String configFile, final String fileExtension, final boolean createOnDemand) {
         this.fileExtension = fileExtension;
-        this.lazyCreate = lazyCreate;
+        this.createOnDemand = createOnDemand;
         this.loggerContextRule = new LoggerContextRule(configFile);
         this.chain = loggerContextRule.withCleanFoldersRule(DIR);
     }
@@ -104,18 +104,18 @@ public class RollingAppenderSizeTest {
     }
 
     @Test
-    public void testIsLazyCreate() {
+    public void testIsCreateOnDemand() {
         final RollingFileAppender rfAppender = loggerContextRule.getRequiredAppender("RollingFile",
                 RollingFileAppender.class);
         final RollingFileManager manager = rfAppender.getManager();
         Assert.assertNotNull(manager);
-        Assert.assertEquals(lazyCreate, manager.isLazyCreate());
+        Assert.assertEquals(createOnDemand, manager.isCreateOnDemand());
     }
 
     @Test
     public void testAppender() throws Exception {
         final Path path = Paths.get(DIR, "rollingtest.log");
-        if (Files.exists(path) && lazyCreate) {
+        if (Files.exists(path) && createOnDemand) {
             Assert.fail(String.format("Unexpected file: %s (%s bytes)", path, Files.getAttribute(path, "size")));
         }
         for (int i = 0; i < 100; ++i) {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml
index ce16320..597f102 100644
--- a/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml
+++ b/log4j-core/src/test/resources/log4j-rolling-7z-lazy.xml
@@ -28,7 +28,7 @@
     </Console>
     <RollingFile name="RollingFile" fileName="${filename}"
                  filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.7z"
-                 lazyCreate="true">
+                 createOnDemand="true">
       <PatternLayout>
         <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
       </PatternLayout>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml
index 6697293..eed50b1 100644
--- a/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml
+++ b/log4j-core/src/test/resources/log4j-rolling-bzip2-lazy.xml
@@ -28,7 +28,7 @@
     </Console>
     <RollingFile name="RollingFile" fileName="${filename}"
                  filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.bz2"
-                 lazyCreate="true">
+                 createOnDemand="true">
       <PatternLayout>
         <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
       </PatternLayout>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml
index d4561f7..1501db7 100644
--- a/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml
+++ b/log4j-core/src/test/resources/log4j-rolling-deflate-lazy.xml
@@ -28,7 +28,7 @@
     </Console>
     <RollingFile name="RollingFile" fileName="${filename}"
                  filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.deflate"
-                 lazyCreate="true">
+                 createOnDemand="true">
       <PatternLayout>
         <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
       </PatternLayout>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml
index f9bfd90..fb85da5 100644
--- a/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml
+++ b/log4j-core/src/test/resources/log4j-rolling-gz-lazy.xml
@@ -28,7 +28,7 @@
     </Console>
     <RollingFile name="RollingFile" fileName="${filename}"
                  filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.gz"
-                 lazyCreate="true">
+                 createOnDemand="true">
       <PatternLayout>
         <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
       </PatternLayout>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml
index 7355e61..db8a6dd 100644
--- a/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml
+++ b/log4j-core/src/test/resources/log4j-rolling-pack200-lazy.xml
@@ -28,7 +28,7 @@
     </Console>
     <RollingFile name="RollingFile" fileName="${filename}"
                  filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.pack200"
-                 lazyCreate="true">
+                 createOnDemand="true">
       <PatternLayout>
         <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
       </PatternLayout>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml
index 02aa528..560741c 100644
--- a/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml
+++ b/log4j-core/src/test/resources/log4j-rolling-xz-lazy.xml
@@ -28,7 +28,7 @@
     </Console>
     <RollingFile name="RollingFile" fileName="${filename}"
                  filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.xz"
-                 lazyCreate="true">
+                 createOnDemand="true">
       <PatternLayout>
         <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
       </PatternLayout>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e5ef989/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml b/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml
index 2641d7f..06249d8 100644
--- a/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml
+++ b/log4j-core/src/test/resources/log4j-rolling-zip-lazy.xml
@@ -28,7 +28,7 @@
     </Console>
     <RollingFile name="RollingFile" fileName="${filename}"
                  filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.zip"
-                 lazyCreate="true">
+                 createOnDemand="true">
       <PatternLayout>
         <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
       </PatternLayout>


[07/24] logging-log4j2 git commit: Don't need ()s.

Posted by mi...@apache.org.
Don't need ()s.

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

Branch: refs/heads/LOG4J2-1528
Commit: 1f232974db103b64a3b6741fe8f8bea18a899ae9
Parents: 4e5ef98
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Aug 19 18:13:16 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Aug 19 18:13:16 2016 -0700

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/async/DaemonThreadFactory.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1f232974/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
index f853b32..90a15e0 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DaemonThreadFactory.java
@@ -33,8 +33,7 @@ public class DaemonThreadFactory implements ThreadFactory {
     public DaemonThreadFactory(final String threadNamePrefix) {
         this.threadNamePrefix = threadNamePrefix;
         final SecurityManager securityManager = System.getSecurityManager();
-        group = (securityManager != null) ? securityManager.getThreadGroup()
-                : Thread.currentThread().getThreadGroup();
+        group = securityManager != null ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
     }
 
     @Override


[16/24] logging-log4j2 git commit: Use Log4jThread to name the thread.

Posted by mi...@apache.org.
Use Log4jThread to name the thread.

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

Branch: refs/heads/LOG4J2-1528
Commit: f1b61bddf640ecc5d2c80ea190ff7332577cb787
Parents: 1aa3c3e
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 17:30:16 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 17:30:16 2016 -0700

----------------------------------------------------------------------
 .../core/appender/mom/kafka/KafkaManager.java   | 185 +++++++++----------
 1 file changed, 92 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f1b61bdd/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java
index 4e4a09c..d535e02 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java
@@ -1,93 +1,92 @@
-/*
- * 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.appender.mom.kafka;
-
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.kafka.clients.producer.Producer;
-import org.apache.kafka.clients.producer.ProducerRecord;
-import org.apache.logging.log4j.core.appender.AbstractManager;
-import org.apache.logging.log4j.core.config.Property;
-import org.apache.logging.log4j.core.util.Log4jThread;
-
-public class KafkaManager extends AbstractManager {
-
-    public static final String DEFAULT_TIMEOUT_MILLIS = "30000";
-
-    /**
-     * package-private access for testing.
-     */
-    static KafkaProducerFactory producerFactory = new DefaultKafkaProducerFactory();
-
-    private final Properties config = new Properties();
-    private Producer<byte[], byte[]> producer = null;
-    private final int timeoutMillis;
-
-    private final String topic;
-
-    public KafkaManager(final String name, final String topic, final Property[] properties) {
-        super(name);
-        this.topic = topic;
-        config.setProperty("key.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
-        config.setProperty("value.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
-        config.setProperty("batch.size", "0");
-        for (final Property property : properties) {
-            config.setProperty(property.getName(), property.getValue());
-        }
-        this.timeoutMillis = Integer.parseInt(config.getProperty("timeout.ms", DEFAULT_TIMEOUT_MILLIS));
-    }
-
-    @Override
-    public void releaseSub() {
-        if (producer != null) {
-            // This thread is a workaround for this Kafka issue: https://issues.apache.org/jira/browse/KAFKA-1660
-            final Thread closeThread = new Log4jThread(new Runnable() {
-                @Override
-                public void run() {
-                    producer.close();
-                }
-            });
-            closeThread.setName("KafkaManager-CloseThread");
-            closeThread.setDaemon(true); // avoid blocking JVM shutdown
-            closeThread.start();
-            try {
-                closeThread.join(timeoutMillis);
-            } catch (final InterruptedException ignore) {
-                // ignore
-            }
-        }
-    }
-
-    public void send(final byte[] msg) throws ExecutionException, InterruptedException, TimeoutException {
-        if (producer != null) {
-            producer.send(new ProducerRecord<byte[], byte[]>(topic, msg)).get(timeoutMillis, TimeUnit.MILLISECONDS);
-        }
-    }
-
-    public void startup() {
-        producer = producerFactory.newKafkaProducer(config);
-    }
-
-    public String getTopic() {
-        return topic;
-    }
-
-}
+/*
+ * 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.appender.mom.kafka;
+
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.kafka.clients.producer.Producer;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.logging.log4j.core.appender.AbstractManager;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.util.Log4jThread;
+
+public class KafkaManager extends AbstractManager {
+
+    public static final String DEFAULT_TIMEOUT_MILLIS = "30000";
+
+    /**
+     * package-private access for testing.
+     */
+    static KafkaProducerFactory producerFactory = new DefaultKafkaProducerFactory();
+
+    private final Properties config = new Properties();
+    private Producer<byte[], byte[]> producer = null;
+    private final int timeoutMillis;
+
+    private final String topic;
+
+    public KafkaManager(final String name, final String topic, final Property[] properties) {
+        super(name);
+        this.topic = topic;
+        config.setProperty("key.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
+        config.setProperty("value.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
+        config.setProperty("batch.size", "0");
+        for (final Property property : properties) {
+            config.setProperty(property.getName(), property.getValue());
+        }
+        this.timeoutMillis = Integer.parseInt(config.getProperty("timeout.ms", DEFAULT_TIMEOUT_MILLIS));
+    }
+
+    @Override
+    public void releaseSub() {
+        if (producer != null) {
+            // This thread is a workaround for this Kafka issue: https://issues.apache.org/jira/browse/KAFKA-1660
+            final Thread closeThread = new Log4jThread(new Runnable() {
+                @Override
+                public void run() {
+                    producer.close();
+                }
+            }, "KafkaManager-CloseThread");
+            closeThread.setDaemon(true); // avoid blocking JVM shutdown
+            closeThread.start();
+            try {
+                closeThread.join(timeoutMillis);
+            } catch (final InterruptedException ignore) {
+                // ignore
+            }
+        }
+    }
+
+    public void send(final byte[] msg) throws ExecutionException, InterruptedException, TimeoutException {
+        if (producer != null) {
+            producer.send(new ProducerRecord<byte[], byte[]>(topic, msg)).get(timeoutMillis, TimeUnit.MILLISECONDS);
+        }
+    }
+
+    public void startup() {
+        producer = producerFactory.newKafkaProducer(config);
+    }
+
+    public String getTopic() {
+        return topic;
+    }
+
+}


[09/24] logging-log4j2 git commit: Normalize thread names to be separated with "-".

Posted by mi...@apache.org.
Normalize thread names to be separated with "-".

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

Branch: refs/heads/LOG4J2-1528
Commit: f6dc77616c4822150dab5821ae2a8a3004d44319
Parents: 921b330
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Aug 19 18:33:37 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Aug 19 18:33:37 2016 -0700

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java  | 2 +-
 .../src/main/java/org/apache/logging/log4j/core/jmx/Server.java    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f6dc7761/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
index a2dcb19..1875ad2 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
@@ -81,7 +81,7 @@ class AsyncLoggerDisruptor {
         LOGGER.trace("[{}] AsyncLoggerDisruptor creating new disruptor for this context.", contextName);
         ringBufferSize = DisruptorUtil.calculateRingBufferSize("AsyncLogger.RingBufferSize");
         final WaitStrategy waitStrategy = DisruptorUtil.createWaitStrategy("AsyncLogger.WaitStrategy");
-        executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory("AsyncLogger[" + contextName + "]"));
+        executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory("AsyncLogger[" + contextName + "]-"));
         backgroundThreadId = DisruptorUtil.getExecutorThreadId(executor);
         asyncQueueFullPolicy = AsyncQueueFullPolicyFactory.create();
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f6dc7761/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
index cafbb41..fd14e11 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
@@ -59,7 +59,7 @@ public final class Server {
     public static final String DOMAIN = "org.apache.logging.log4j2";
     private static final String PROPERTY_DISABLE_JMX = "log4j2.disable.jmx";
     private static final String PROPERTY_ASYNC_NOTIF = "log4j2.jmx.notify.async";
-    private static final String THREAD_NAME_PREFIX = "log4j2.jmx.notif";
+    private static final String THREAD_NAME_PREFIX = "log4j2.jmx.notif-";
     private static final StatusLogger LOGGER = StatusLogger.getLogger();
     static final Executor executor = isJmxDisabled() ? null : createExecutor();
 


[05/24] logging-log4j2 git commit: Merge remote-tracking branch 'origin/master'

Posted by mi...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/LOG4J2-1528
Commit: b3d6a39b00b167ce1e56c2a03e2e4512ef991f08
Parents: 147f78c 93f55f3
Author: rpopma <rp...@apache.org>
Authored: Sat Aug 20 09:44:37 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Aug 20 09:44:37 2016 +0900

----------------------------------------------------------------------
 .../log4j/core/appender/FileManager.java        |  12 +-
 .../core/appender/OutputStreamManager.java      |  18 +-
 .../core/appender/RollingFileAppender.java      | 372 ++++++++++++-------
 .../appender/rolling/RollingFileManager.java    |  50 ++-
 .../rolling/OnStartupTriggeringPolicyTest.java  |  10 +-
 .../rolling/RollingAppenderSizeTest.java        |  43 ++-
 .../rolling/RollingFileAppenderAccessTest.java  |  61 +--
 .../test/resources/log4j-rolling-7z-lazy.xml    |  59 +++
 .../test/resources/log4j-rolling-bzip2-lazy.xml |  60 +++
 .../resources/log4j-rolling-deflate-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-gz-lazy.xml    |  59 +++
 .../resources/log4j-rolling-pack200-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-xz-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-zip-lazy.xml   |  60 +++
 src/changes/changes.xml                         |   5 +-
 15 files changed, 791 insertions(+), 198 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b3d6a39b/src/changes/changes.xml
----------------------------------------------------------------------


[23/24] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1528

Posted by mi...@apache.org.
Merge branch 'master' into LOG4J2-1528


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

Branch: refs/heads/LOG4J2-1528
Commit: cc215c76d41f8eeb6e8a273c16387a194b63278e
Parents: 7a1cd3a 03fe13f
Author: Mikael St�ldal <mi...@staldal.nu>
Authored: Sun Aug 21 10:17:23 2016 +0200
Committer: Mikael St�ldal <mi...@staldal.nu>
Committed: Sun Aug 21 10:17:23 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/Logger.java   |  20 +
 .../org/apache/logging/log4j/ThreadContext.java |  55 +--
 .../log4j/spi/DefaultThreadContextMap.java      |   6 +-
 .../logging/log4j/spi/ThreadContextMap.java     |  13 +-
 .../logging/log4j/spi/ThreadContextMap2.java    |  40 ++
 .../logging/log4j/spi/ThreadContextStack.java   |   1 +
 .../logging/log4j/core/LoggerContext.java       |   1 +
 .../log4j/core/appender/AbstractManager.java    |   2 +
 .../log4j/core/appender/FileAppender.java       |  12 +-
 .../log4j/core/appender/FileManager.java        |  36 +-
 .../core/appender/OutputStreamManager.java      |  18 +-
 .../core/appender/RollingFileAppender.java      | 372 ++++++++++++-------
 .../core/appender/mom/kafka/KafkaManager.java   | 185 +++++----
 .../appender/rolling/RollingFileManager.java    |  50 ++-
 .../core/async/AsyncLoggerConfigDisruptor.java  |   3 +-
 .../log4j/core/async/AsyncLoggerDisruptor.java  |   3 +-
 .../log4j/core/async/DaemonThreadFactory.java   |  53 ---
 .../log4j/core/async/RingBufferLogEvent.java    |   4 +-
 .../core/config/ConfigurationScheduler.java     |  15 +-
 .../config/composite/DefaultMergeStrategy.java  |   1 +
 .../apache/logging/log4j/core/jmx/Server.java   |   5 +-
 .../log4j/core/layout/PatternLayout.java        |   4 +-
 .../logging/log4j/core/util/Log4jThread.java    | 138 +++----
 .../log4j/core/util/Log4jThreadFactory.java     |  88 +++++
 .../log4j/core/appender/FileAppenderTest.java   |  48 +--
 .../rolling/OnStartupTriggeringPolicyTest.java  |  10 +-
 .../rolling/RollingAppenderSizeTest.java        |  43 ++-
 .../rolling/RollingFileAppenderAccessTest.java  |  61 +--
 .../core/async/RingBufferLogEventTest.java      |  18 +-
 .../core/config/CompositeConfigurationTest.java |  34 +-
 .../log4j-comp-logger-attr-override.json        |  38 ++
 .../test/resources/log4j-comp-logger-root.xml   |  44 +++
 .../test/resources/log4j-rolling-7z-lazy.xml    |  59 +++
 .../test/resources/log4j-rolling-bzip2-lazy.xml |  60 +++
 .../resources/log4j-rolling-deflate-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-gz-lazy.xml    |  59 +++
 .../resources/log4j-rolling-pack200-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-xz-lazy.xml    |  60 +++
 .../test/resources/log4j-rolling-zip-lazy.xml   |  60 +++
 .../flume/appender/FlumePersistentManager.java  |  30 +-
 .../org/apache/logging/slf4j/MDCContextMap.java |   7 +-
 src/changes/changes.xml                         |  15 +-
 src/site/xdoc/manual/appenders.xml              |  18 +-
 43 files changed, 1354 insertions(+), 555 deletions(-)
----------------------------------------------------------------------



[24/24] logging-log4j2 git commit: Unit test for ConfigurationBuilder XML generation

Posted by mi...@apache.org.
Unit test for ConfigurationBuilder XML generation


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

Branch: refs/heads/LOG4J2-1528
Commit: ce08bfbe41cc96b891446fd76595ac3611f92b5e
Parents: cc215c7
Author: Mikael St�ldal <mi...@staldal.nu>
Authored: Sun Aug 21 10:41:39 2016 +0200
Committer: Mikael St�ldal <mi...@staldal.nu>
Committed: Sun Aug 21 10:41:39 2016 +0200

----------------------------------------------------------------------
 .../impl/DefaultConfigurationBuilder.java       |  1 +
 .../builder/ConfigurationBuilderTest.java       | 61 ++++++++++++++++++++
 2 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ce08bfbe/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java
index 2fc78f4..b32b037 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java
@@ -262,6 +262,7 @@ public class DefaultConfigurationBuilder<T extends BuiltConfiguration> implement
         }
 
         xmlWriter.writeEndElement(); // "Configuration"
+        xmlWriter.writeCharacters(System.lineSeparator());
 
         xmlWriter.writeEndDocument();
     }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ce08bfbe/log4j-core/src/test/java/org/apache/logging/log4j/core/config/builder/ConfigurationBuilderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/builder/ConfigurationBuilderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/builder/ConfigurationBuilderTest.java
new file mode 100644
index 0000000..3d8c4d2
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/builder/ConfigurationBuilderTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.config.builder;
+
+import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
+import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory;
+import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ConfigurationBuilderTest {
+
+    private final static String expectedXml =
+            "<?xml version='1.0' encoding='UTF-8'?>" + System.lineSeparator() +
+            "<Configuration name=\"config name\" status=\"ERROR\">" + System.lineSeparator() +
+            "\t<Scripts>" + System.lineSeparator() +
+            "\t\t<ScriptFile path=\"target/test-classes/scripts/filter.groovy\" name=\"target/test-classes/scripts/filter.groovy\" isWatched=\"true\"/>" + System.lineSeparator() +
+            "\t</Scripts>" + System.lineSeparator() +
+            "\t<Filters>" + System.lineSeparator() +
+            "\t\t<ThresholdFilter onMatch=\"ACCEPT\" level=\"DEBUG\" onMisMatch=\"NEUTRAL\"/>" + System.lineSeparator() +
+            "\t</Filters>" + System.lineSeparator() +
+            "\t<Appenders>" + System.lineSeparator() +
+            "\t\t<CONSOLE name=\"Stdout\" target=\"SYSTEM_OUT\">" + System.lineSeparator() +
+            "\t\t\t<PatternLayout pattern=\"%d [%t] %-5level: %msg%n%throwable\"/>" + System.lineSeparator() +
+            "\t\t\t<MarkerFilter onMatch=\"DENY\" onMisMatch=\"NEUTRAL\" marker=\"FLOW\"/>" + System.lineSeparator() +
+            "\t\t</CONSOLE>" + System.lineSeparator() +
+            "\t</Appenders>" + System.lineSeparator() +
+            "\t<Loggers>" + System.lineSeparator() +
+            "\t\t<Logger additivity=\"false\" level=\"DEBUG\" includeLocation=\"true\" name=\"org.apache.logging.log4j\">" + System.lineSeparator() +
+            "\t\t\t<AppenderRef ref=\"Stdout\"/>" + System.lineSeparator() +
+            "\t\t</Logger>" + System.lineSeparator() +
+            "\t\t<Root level=\"ERROR\" includeLocation=\"true\">" + System.lineSeparator() +
+            "\t\t\t<AppenderRef ref=\"Stdout\"/>" + System.lineSeparator() +
+            "\t\t</Root>" + System.lineSeparator() +
+            "\t</Loggers>" + System.lineSeparator() +
+            "</Configuration>" + System.lineSeparator();
+
+    @Test
+    public void testXmlConstructing() throws Exception {
+        final ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();
+        CustomConfigurationFactory.addTestFixtures("config name", builder);
+        final String xmlConfiguration = builder.toXmlConfiguration();
+        assertEquals(expectedXml, xmlConfiguration);
+    }
+
+}


[03/24] logging-log4j2 git commit: Merge remote-tracking branch 'origin/master'

Posted by mi...@apache.org.
Merge remote-tracking branch 'origin/master'

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

Branch: refs/heads/LOG4J2-1528
Commit: 93f55f378d72e806ac0672f88d24a908097d654b
Parents: a82794f 6a23301
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Aug 19 17:27:38 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Aug 19 17:27:38 2016 -0700

----------------------------------------------------------------------
 .../org/apache/logging/log4j/ThreadContext.java | 55 +++++++++++---------
 .../log4j/spi/DefaultThreadContextMap.java      |  6 +--
 .../logging/log4j/spi/ThreadContextMap.java     | 13 +----
 .../logging/log4j/spi/ThreadContextMap2.java    | 40 ++++++++++++++
 .../org/apache/logging/slf4j/MDCContextMap.java |  7 +--
 src/changes/changes.xml                         |  4 +-
 6 files changed, 81 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/93f55f37/src/changes/changes.xml
----------------------------------------------------------------------


[14/24] logging-log4j2 git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/logging-log4j2.git

Posted by mi...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/logging-log4j2.git

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

Branch: refs/heads/LOG4J2-1528
Commit: 4f793c00fbc90390b5fe075d5e8840574b0fd03c
Parents: 9afe7ea 5aac1af
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 20 11:47:21 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Sat Aug 20 11:47:21 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/core/layout/PatternLayout.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------