You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2015/08/09 18:16:57 UTC

[01/11] logging-log4j2 git commit: LOG4J2-599 initial changes to support succinct lazy logging

Repository: logging-log4j2
Updated Branches:
  refs/heads/master c49391fdf -> b0e473bb2


LOG4J2-599 initial changes to support succinct lazy logging

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

Branch: refs/heads/master
Commit: bccedde109dc8be865856e6bbbf0f0bf91247e4c
Parents: 27caceb
Author: rpopma <rp...@apache.org>
Authored: Thu Aug 6 08:35:24 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Aug 6 08:35:24 2015 +0900

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/Logger.java   | 16 +++++
 .../logging/log4j/spi/AbstractLogger.java       | 40 +++++++++++++
 .../logging/log4j/spi/ExtendedLogger.java       | 26 ++++++++
 .../apache/logging/log4j/util/LambdaUtil.java   | 62 ++++++++++++++++++++
 4 files changed, 144 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bccedde1/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 8f9c837..85364b3 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
@@ -16,6 +16,8 @@
  */
 package org.apache.logging.log4j;
 
+import java.util.concurrent.Callable;
+
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.MessageFactory;
 
@@ -183,6 +185,20 @@ public interface Logger {
     void debug(String message, Throwable t);
 
     /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void debug(Callable<?> msgSupplier);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level.
+     *
+     * @param paramSupplier An array of functions, which when called, produce the desired log message parameters.
+     */
+    void debug(String message, Callable<?>... paramSupplier);
+
+    /**
      * Logs entry to a method. Used when the method in question has no parameters or when the parameters should not be
      * logged.
      */

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bccedde1/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
index d7e4be4..4eb4a50 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
@@ -17,6 +17,7 @@
 package org.apache.logging.log4j.spi;
 
 import java.io.Serializable;
+import java.util.concurrent.Callable;
 
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
@@ -26,6 +27,7 @@ import org.apache.logging.log4j.message.MessageFactory;
 import org.apache.logging.log4j.message.ParameterizedMessageFactory;
 import org.apache.logging.log4j.message.StringFormattedMessage;
 import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.LambdaUtil;
 
 /**
  * Base implementation of a Logger. It is highly recommended that any Logger implementation extend this class.
@@ -218,6 +220,16 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
+    public void debug(Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.DEBUG, null, msgSupplier, null);
+    }
+
+    @Override
+    public void debug(String message, Callable<?>... paramSupplier) {
+        logIfEnabled(FQCN, Level.DEBUG, null, message, paramSupplier);
+    }
+
+    @Override
     public void debug(final Object message) {
         logIfEnabled(FQCN, Level.DEBUG, null, message, null);
     }
@@ -695,6 +707,14 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
+    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final Callable<?> msgSupplier,
+            final Throwable t) {
+        if (isEnabled(level, marker, msgSupplier, t)) {
+            logMessage(fqcn, level, marker, msgSupplier, t);
+        }
+    }
+
+    @Override
     public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final String message) {
         if (isEnabled(level, marker, message)) {
             logMessage(fqcn, level, marker, message);
@@ -703,6 +723,14 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
 
     @Override
     public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final String message,
+            final Callable<?>... paramSuppliers) {
+        if (isEnabled(level, marker, message)) {
+            logMessage(fqcn, level, marker, message, paramSuppliers);
+        }
+    }
+
+    @Override
+    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final String message,
             final Object... params) {
         if (isEnabled(level, marker, message, params)) {
             logMessage(fqcn, level, marker, message, params);
@@ -722,6 +750,12 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
         logMessage(fqcn, level, marker, messageFactory.newMessage(message), t);
     }
 
+    protected void logMessage(final String fqcn, final Level level, final Marker marker, final Callable<?> msgSupplier,
+            final Throwable t) {
+        Object message = LambdaUtil.call(msgSupplier);
+        logMessage(fqcn, level, marker, messageFactory.newMessage(message), t);
+    }
+
     protected void logMessage(final String fqcn, final Level level, final Marker marker, final String message,
             final Throwable t) {
         logMessage(fqcn, level, marker, messageFactory.newMessage(message), t);
@@ -738,6 +772,12 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
         logMessage(fqcn, level, marker, msg, msg.getThrowable());
     }
 
+    protected void logMessage(final String fqcn, final Level level, final Marker marker, final String message,
+            final Callable<?>... paramSuppliers) {
+        final Message msg = messageFactory.newMessage(message, LambdaUtil.callAll(paramSuppliers));
+        logMessage(fqcn, level, marker, msg, msg.getThrowable());
+    }
+
     @Override
     public void printf(final Level level, final Marker marker, final String format, final Object... params) {
         if (isEnabled(level, marker, format, params)) {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bccedde1/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java
index 8a36c57..1771f37 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java
@@ -16,6 +16,8 @@
  */
 package org.apache.logging.log4j.spi;
 
+import java.util.concurrent.Callable;
+
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.Marker;
@@ -94,6 +96,18 @@ public interface ExtendedLogger extends Logger {
     void logIfEnabled(String fqcn, Level level, Marker marker, Message message, Throwable t);
 
     /**
+     * Logs a message which is only to be constructed if the specified level is active.
+     * 
+     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
+     *            method when location information needs to be logged.
+     * @param level The logging Level to check.
+     * @param marker A Marker or null.
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void logIfEnabled(String fqcn, Level level, Marker marker, Callable<?> msgSupplier, Throwable t);
+
+    /**
      * Logs a message if the specified level is active.
      * 
      * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
@@ -141,6 +155,18 @@ public interface ExtendedLogger extends Logger {
     void logIfEnabled(String fqcn, Level level, Marker marker, String message, Object... params);
 
     /**
+     * Logs a message which is only to be constructed if the specified level is active.
+     * 
+     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
+     *            method when location information needs to be logged.
+     * @param level The logging Level to check.
+     * @param marker A Marker or null.
+     * @param message The message format.
+     * @param paramSupplier An array of functions, which when called, produce the desired log message parameters.
+     */
+    void logIfEnabled(String fqcn, Level level, Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
      * Always logs a message at the specified level. It is the responsibility of the caller to ensure the specified
      * level is enabled.
      * 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bccedde1/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
new file mode 100644
index 0000000..9ba491b
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
@@ -0,0 +1,62 @@
+/*
+ * 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.util;
+
+import java.util.concurrent.Callable;
+
+/**
+ * Utility class for lambda support.
+ */
+public class LambdaUtil {
+    /**
+     * Converts an array of lambda expressions into an array of their evaluation results.
+     * 
+     * @param suppliers an array of lambda expressions or {@code null}
+     * @return an array containing the results of evaluating the lambda expressions (or {@code null} if the suppliers
+     *         array was {@code null}
+     */
+    public static Object[] callAll(Callable<?>... suppliers) {
+        if (suppliers == null) {
+            return (Object[]) null;
+        }
+        final Object[] result = new Object[suppliers.length];
+        for (int i = 0; i < result.length; i++) {
+            result[i] = call(suppliers[i]);
+        }
+        return result;
+    }
+
+    /**
+     * Returns the result of evaluating the specified function.
+     * @param supplier a lambda expression or {@code null}
+     * @return the results of evaluating the lambda expression (or {@code null} if the supplier
+     *         was {@code null}
+     */
+    public static Object call(Callable<?> supplier) {
+        if (supplier == null) {
+            return null;
+        }
+        Object result = null;
+        try {
+            result = supplier.call();
+        } catch (Exception ex) {
+            result = ex;
+        }
+        return result;
+    }
+}


[07/11] logging-log4j2 git commit: LOG4J2-599 log4j lambda support - Renamed LambdaLogger to Logger2 - Renamed ExtendedLambdaLogger to ExtendedLogger2 - Renamed LogManager#getLambdaLogger methods to #getLogger2 - Introduced custom functional interface Su

Posted by rp...@apache.org.
LOG4J2-599 log4j lambda support
- Renamed LambdaLogger to Logger2
- Renamed ExtendedLambdaLogger to ExtendedLogger2
- Renamed LogManager#getLambdaLogger methods to #getLogger2
- Introduced custom functional interface Supplier and replaced
Callable<?> in Logger2 with Supplier<?>
- LambdaSupport changes for Supplier instead of Callable
- Introduced custom functional interface MessageSupplier for lambda
expressions that create Message objects directly
- documentation updates
- initial Logger2Test (more tests to follow) 

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

Branch: refs/heads/master
Commit: 12be6d867031c4579ccca856359d04482145e01e
Parents: 63a325d
Author: rpopma <rp...@apache.org>
Authored: Sun Aug 9 23:53:39 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Aug 9 23:53:39 2015 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/LambdaLogger.java  | 429 -----------
 .../org/apache/logging/log4j/LogManager.java    |  72 +-
 .../java/org/apache/logging/log4j/Logger2.java  | 738 +++++++++++++++++++
 .../logging/log4j/spi/AbstractLogger.java       | 270 +++++--
 .../logging/log4j/spi/ExtendedLambdaLogger.java |  56 --
 .../logging/log4j/spi/ExtendedLogger2.java      |  68 ++
 .../apache/logging/log4j/util/LambdaUtil.java   |  24 +-
 .../logging/log4j/util/MessageSupplier.java     |  40 +
 .../org/apache/logging/log4j/util/Supplier.java |  40 +
 .../org/apache/logging/log4j/Logger2Test.java   | 190 +++++
 .../logging/log4j/util/LambdaUtilTest.java      |  95 ++-
 src/site/xdoc/manual/api.xml                    |   6 +-
 12 files changed, 1409 insertions(+), 619 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
deleted file mode 100644
index 84a3fef..0000000
--- a/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
+++ /dev/null
@@ -1,429 +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;
-
-import java.util.concurrent.Callable;
-
-/**
- * Extends the {@code Logger} interface with support for lambda expressions.
- * <p>
- * This logger allows client code to lazily log messages without explicitly checking if the requested log level is
- * enabled. For example, previously one would write:
- * 
- * <pre>
- * // pre-Java 8 style optimization: explicitly check the log level
- * // to make sure the expensiveOperation() method is only called if necessary
- * Logger logger = LogManager.getLogger();
- * if (logger.isTraceEnabled()) {
- *     logger.trace(&quot;Some long-running operation returned {}&quot;, expensiveOperation());
- * }
- * </pre>
- * <p>
- * With Java 8 and the {@code LambdaLogger} interface, one can achieve the same effect by using a lambda expression:
- * 
- * <pre>
- * // Java-8 style optimization: no need to explicitly check the log level:
- * // the lambda expression is not evaluated if the TRACE level is not enabled
- * LambdaLogger logger = LogManager.getLambdaLogger();
- * logger.trace(&quot;Some long-running operation returned {}&quot;, () -&gt; expensiveOperation());
- * </pre>
- */
-public interface LambdaLogger extends Logger {
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void debug(Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level) including the
-     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack trace.
-     */
-    void debug(Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level with
-     * the specified Marker.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void debug(Marker marker, Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level) with the
-     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t A Throwable or null.
-     */
-    void debug(Marker marker, Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#DEBUG
-     * DEBUG} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void debug(Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#DEBUG
-     * DEBUG} level.
-     *
-     * @param message the message to log; the format depends on the message factory.
-     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void debug(String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void error(Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) including the
-     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack trace.
-     */
-    void error(Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level with
-     * the specified Marker.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void error(Marker marker, Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) with the
-     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t A Throwable or null.
-     */
-    void error(Marker marker, Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#ERROR
-     * ERROR} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void error(Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#ERROR
-     * ERROR} level.
-     *
-     * @param message the message to log; the format depends on the message factory.
-     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void error(String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void fatal(Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) including the
-     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack trace.
-     */
-    void fatal(Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level with
-     * the specified Marker.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void fatal(Marker marker, Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) with the
-     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t A Throwable or null.
-     */
-    void fatal(Marker marker, Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#FATAL
-     * FATAL} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void fatal(Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#FATAL
-     * FATAL} level.
-     *
-     * @param message the message to log; the format depends on the message factory.
-     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void fatal(String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void info(Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) including the
-     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack trace.
-     */
-    void info(Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level with the
-     * specified Marker.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void info(Marker marker, Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) with the
-     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t A Throwable or null.
-     */
-    void info(Marker marker, Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#INFO
-     * INFO} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void info(Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#INFO
-     * INFO} level.
-     *
-     * @param message the message to log; the format depends on the message factory.
-     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void info(String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the specified level.
-     *
-     * @param level the logging level
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void log(Level level, Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the specified level) including the stack log of
-     * the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param level the logging level
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack log.
-     */
-    void log(Level level, Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the specified level) with the specified Marker.
-     *
-     * @param level the logging level
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void log(Level level, Marker marker, Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the specified level) with the specified Marker and
-     * including the stack log of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param level the logging level
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t A Throwable or null.
-     */
-    void log(Level level, Marker marker, Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void log(Level level, Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the specified level.
-     *
-     * @param level the logging level
-     * @param message the message to log; the format depends on the message factory.
-     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void log(Level level, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void trace(Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) including the
-     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack trace.
-     */
-    void trace(Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level with
-     * the specified Marker.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void trace(Marker marker, Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) with the
-     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t A Throwable or null.
-     */
-    void trace(Marker marker, Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#TRACE
-     * TRACE} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void trace(Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#TRACE
-     * TRACE} level.
-     *
-     * @param message the message to log; the format depends on the message factory.
-     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void trace(String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void warn(Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) including the
-     * stack warn of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack warn.
-     */
-    void warn(Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level with the
-     * specified Marker.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void warn(Marker marker, Callable<?> msgSupplier);
-
-    /**
-     * Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) with the
-     * specified Marker and including the stack warn of the {@link Throwable} <code>t</code> passed as parameter.
-     *
-     * @param marker the marker data specific to this log statement
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t A Throwable or null.
-     */
-    void warn(Marker marker, Callable<?> msgSupplier, Throwable t);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#WARN
-     * WARN} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void warn(Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#WARN
-     * WARN} level.
-     *
-     * @param message the message to log; the format depends on the message factory.
-     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void warn(String message, Callable<?>... paramSuppliers);
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
index f4aa848..196aa9f 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
@@ -416,12 +416,13 @@ public class LogManager {
     }
 
     /**
-     * Returns a LambdaLogger with the name of the calling class.
-     * @return The LambdaLogger for the calling class.
+     * Returns a Logger2 with the name of the calling class.
+     * @return The Logger2 for the calling class.
      * @throws UnsupportedOperationException if the calling class cannot be determined.
+     * @since log4j-2.4
      */
-    public static LambdaLogger getLambdaLogger() {
-        return (LambdaLogger) getLogger(ReflectionUtil.getCallerClass(2));
+    public static Logger2 getLogger2() {
+        return (Logger2) getLogger(ReflectionUtil.getCallerClass(2));
     }
     
     private static Class<?> callerClass(final Class<?> clazz) {
@@ -436,90 +437,97 @@ public class LogManager {
     }
 
     /**
-     * Returns a LambdaLogger using the fully qualified name of the Class as the Logger name.
+     * Returns a Logger2 using the fully qualified name of the Class as the Logger name.
      * @param clazz The Class whose name should be used as the Logger name. If null it will default to the calling
      *              class.
-     * @return The LambdaLogger.
+     * @return The Logger2.
      * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
+     * @since log4j-2.4
      */
-    public static LambdaLogger getLambdaLogger(final Class<?> clazz) {
+    public static Logger2 getLogger2(final Class<?> clazz) {
         final Class<?> cls = callerClass(clazz);
-        return (LambdaLogger) getContext(cls.getClassLoader(), false).getLogger(cls.getName());
+        return (Logger2) getContext(cls.getClassLoader(), false).getLogger(cls.getName());
     }
 
     /**
-     * Returns a LambdaLogger using the fully qualified name of the Class as the Logger name.
+     * Returns a Logger2 using the fully qualified name of the Class as the Logger name.
      * @param clazz The Class whose name should be used as the Logger name. If null it will default to the calling
      *              class.
      * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
      *                       the logger but will log a warning if mismatched.
-     * @return The LambdaLogger.
+     * @return The Logger2.
      * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
+     * @since log4j-2.4
      */
-    public static LambdaLogger getLambdaLogger(final Class<?> clazz, final MessageFactory messageFactory) {
+    public static Logger2 getLogger2(final Class<?> clazz, final MessageFactory messageFactory) {
         final Class<?> cls = callerClass(clazz);
-        return (LambdaLogger) getContext(cls.getClassLoader(), false).getLogger(cls.getName(), messageFactory);
+        return (Logger2) getContext(cls.getClassLoader(), false).getLogger(cls.getName(), messageFactory);
     }
 
     /**
-     * Returns a LambdaLogger with the name of the calling class.
+     * Returns a Logger2 with the name of the calling class.
      * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
      *                       the logger but will log a warning if mismatched.
-     * @return The LambdaLogger for the calling class.
+     * @return The Logger2 for the calling class.
      * @throws UnsupportedOperationException if the calling class cannot be determined.
+     * @since log4j-2.4
      */
-    public static LambdaLogger getLambdaLogger(final MessageFactory messageFactory) {
-        return (LambdaLogger) getLogger(ReflectionUtil.getCallerClass(2), messageFactory);
+    public static Logger2 getLogger2(final MessageFactory messageFactory) {
+        return (Logger2) getLogger(ReflectionUtil.getCallerClass(2), messageFactory);
     }
 
     /**
-     * Returns a LambdaLogger using the fully qualified class name of the value as the Logger name.
+     * Returns a Logger2 using the fully qualified class name of the value as the Logger name.
      * @param value The value whose class name should be used as the Logger name. If null the name of the calling
      *              class will be used as the logger name.
-     * @return The LambdaLogger.
+     * @return The Logger2.
      * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be determined.
+     * @since log4j-2.4
      */
-    public static LambdaLogger getLambdaLogger(final Object value) {
-        return (LambdaLogger) getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2));
+    public static Logger2 getLogger2(final Object value) {
+        return (Logger2) getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2));
     }
 
     /**
-     * Returns a LambdaLogger using the fully qualified class name of the value as the Logger name.
+     * Returns a Logger2 using the fully qualified class name of the value as the Logger name.
      * @param value The value whose class name should be used as the Logger name. If null the name of the calling
      *              class will be used as the logger name.
      * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
      *                       the logger but will log a warning if mismatched.
-     * @return The LambdaLogger.
+     * @return The Logger2.
      * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be determined.
+     * @since log4j-2.4
      */
-    public static LambdaLogger getLambdaLogger(final Object value, final MessageFactory messageFactory) {
-        return (LambdaLogger) getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2),
+    public static Logger2 getLogger2(final Object value, final MessageFactory messageFactory) {
+        return (Logger2) getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2),
                 messageFactory);
     }
 
     /**
-     * Returns a LambdaLogger with the specified name.
+     * Returns a Logger2 with the specified name.
      *
      * @param name The logger name. If null the name of the calling class will be used.
-     * @return The LambdaLogger.
+     * @return The Logger2.
      * @throws UnsupportedOperationException if {@code name} is {@code null} and the calling class cannot be determined.
+     * @since log4j-2.4
      */
-    public static LambdaLogger getLambdaLogger(final String name) {
-        return (LambdaLogger) (name != null ? getContext(false).getLogger(name) : getLogger(
+    public static Logger2 getLogger2(final String name) {
+        return (Logger2) (name != null ? getContext(false).getLogger(name) : getLogger(
                 ReflectionUtil.getCallerClass(2)));
     }
 
     /**
-     * Returns a LambdaLogger with the specified name.
+     * Returns a Logger2 with the specified name.
      *
      * @param name The logger name. If null the name of the calling class will be used.
      * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
      *                       the logger but will log a warning if mismatched.
-     * @return The LambdaLogger.
+     * @return The Logger2.
      * @throws UnsupportedOperationException if {@code name} is {@code null} and the calling class cannot be determined.
+     * @since log4j-2.4
      */
-    public static LambdaLogger getLambdaLogger(final String name, final MessageFactory messageFactory) {
-        return (LambdaLogger) (name != null ? getContext(false).getLogger(name, messageFactory) : getLogger(
+    public static Logger2 getLogger2(final String name, final MessageFactory messageFactory) {
+        return (Logger2) (name != null ? getContext(false).getLogger(name, messageFactory) : getLogger(
             ReflectionUtil.getCallerClass(2), messageFactory));
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/Logger2.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/Logger2.java b/log4j-api/src/main/java/org/apache/logging/log4j/Logger2.java
new file mode 100644
index 0000000..4315841
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/Logger2.java
@@ -0,0 +1,738 @@
+/*
+ * 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;
+
+import org.apache.logging.log4j.message.MessageFactory;
+import org.apache.logging.log4j.util.MessageSupplier;
+import org.apache.logging.log4j.util.Supplier;
+
+/**
+ * Extends the {@code Logger} interface with support for lambda expressions.
+ * <p>
+ * This logger allows client code to lazily log messages without explicitly checking if the requested log level is
+ * enabled. For example, previously one would write:
+ * 
+ * <pre>
+ * // pre-Java 8 style optimization: explicitly check the log level
+ * // to make sure the expensiveOperation() method is only called if necessary
+ * Logger logger = LogManager.getLogger();
+ * if (logger.isTraceEnabled()) {
+ *     logger.trace(&quot;Some long-running operation returned {}&quot;, expensiveOperation());
+ * }
+ * </pre>
+ * <p>
+ * With Java 8 and the {@code Logger2} interface, one can achieve the same effect by using a lambda expression:
+ * 
+ * <pre>
+ * // Java-8 style optimization: no need to explicitly check the log level:
+ * // the lambda expression is not evaluated if the TRACE level is not enabled
+ * Logger2 logger = LogManager.getLogger2();
+ * logger.trace(&quot;Some long-running operation returned {}&quot;, () -&gt; expensiveOperation());
+ * </pre>
+ * 
+ * @since log4j-2.4
+ */
+public interface Logger2 extends Logger {
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void debug(Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t the exception to log, including its stack trace.
+     */
+    void debug(Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level with
+     * the specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void debug(Marker marker, Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t A Throwable or null.
+     */
+    void debug(Marker marker, Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level with
+     * the specified Marker. The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the
+     * {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void debug(Marker marker, MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter. The
+     * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void debug(Marker marker, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level. The
+     * {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void debug(MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter. The {@code MessageSupplier} may or may
+     * not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void debug(MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#DEBUG
+     * DEBUG} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void debug(Marker marker, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#DEBUG
+     * DEBUG} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void debug(String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void error(Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t the exception to log, including its stack trace.
+     */
+    void error(Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level with
+     * the specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void error(Marker marker, Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t A Throwable or null.
+     */
+    void error(Marker marker, Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#ERROR
+     * ERROR} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void error(Marker marker, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level with
+     * the specified Marker. 
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void error(Marker marker, MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void error(Marker marker, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void error(MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void error(MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#ERROR
+     * ERROR} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void error(String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void fatal(Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t the exception to log, including its stack trace.
+     */
+    void fatal(Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level with
+     * the specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void fatal(Marker marker, Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t A Throwable or null.
+     */
+    void fatal(Marker marker, Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#FATAL
+     * FATAL} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void fatal(Marker marker, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level with
+     * the specified Marker. 
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void fatal(Marker marker, MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void fatal(Marker marker, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void fatal(MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void fatal(MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#FATAL
+     * FATAL} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void fatal(String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void info(Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t the exception to log, including its stack trace.
+     */
+    void info(Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level with the
+     * specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void info(Marker marker, Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t A Throwable or null.
+     */
+    void info(Marker marker, Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#INFO
+     * INFO} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void info(Marker marker, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level with
+     * the specified Marker. 
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void info(Marker marker, MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void info(Marker marker, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void info(MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void info(MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#INFO
+     * INFO} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void info(String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the specified level.
+     *
+     * @param level the logging level
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void log(Level level, Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the specified level) including the stack log of
+     * the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param level the logging level
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t the exception to log, including its stack log.
+     */
+    void log(Level level, Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the specified level) with the specified Marker.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void log(Level level, Marker marker, Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the specified level) with the specified Marker and
+     * including the stack log of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t A Throwable or null.
+     */
+    void log(Level level, Marker marker, Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void log(Level level, Marker marker, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the specified level with
+     * the specified Marker. 
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void log(Level level, Marker marker, MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the specified level) with the
+     * specified Marker and including the stack log of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void log(Level level, Marker marker, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the specified level.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param level the logging level
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void log(Level level, MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the specified level) including the
+     * stack log of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param level the logging level
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack log.
+     */
+    void log(Level level, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the specified level.
+     *
+     * @param level the logging level
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void log(Level level, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void trace(Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t the exception to log, including its stack trace.
+     */
+    void trace(Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level with
+     * the specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void trace(Marker marker, Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t A Throwable or null.
+     */
+    void trace(Marker marker, Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#TRACE
+     * TRACE} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void trace(Marker marker, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level with
+     * the specified Marker. 
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void trace(Marker marker, MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void trace(Marker marker, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void trace(MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void trace(MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#TRACE
+     * TRACE} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void trace(String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void warn(Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) including the
+     * stack warn of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t the exception to log, including its stack warn.
+     */
+    void warn(Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level with the
+     * specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     */
+    void warn(Marker marker, Supplier<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) with the
+     * specified Marker and including the stack warn of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message; the format depends on the
+     *            message factory.
+     * @param t A Throwable or null.
+     */
+    void warn(Marker marker, Supplier<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#WARN
+     * WARN} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void warn(Marker marker, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level with
+     * the specified Marker. 
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void warn(Marker marker, MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) with the
+     * specified Marker and including the stack warn of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void warn(Marker marker, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void warn(MessageSupplier msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) including the
+     * stack warn of the {@link Throwable} <code>t</code> passed as parameter.
+     * The {@code MessageSupplier} may or may not use the {@link MessageFactory} to construct the {@code Message}.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack warn.
+     */
+    void warn(MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#WARN
+     * WARN} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void warn(String message, Supplier<?>... paramSuppliers);
+
+}


[04/11] logging-log4j2 git commit: LOG4J2-599 documentation

Posted by rp...@apache.org.
LOG4J2-599 documentation

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

Branch: refs/heads/master
Commit: cf3ced44344ee46e5ff24399882e540de3f59fac
Parents: faa36c3
Author: rpopma <rp...@apache.org>
Authored: Fri Aug 7 01:03:51 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Fri Aug 7 01:03:51 2015 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/LambdaLogger.java  |  2 +-
 src/site/xdoc/index.xml                         |  8 +++++++
 src/site/xdoc/manual/api.xml                    | 23 ++++++++++++++++++++
 src/site/xdoc/manual/index.xml                  |  3 +++
 4 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cf3ced44/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
index ea08013..84a3fef 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
@@ -39,7 +39,7 @@ import java.util.concurrent.Callable;
  * <pre>
  * // Java-8 style optimization: no need to explicitly check the log level:
  * // the lambda expression is not evaluated if the TRACE level is not enabled
- * Logger2 logger = LogManager.getLambdaLogger();
+ * LambdaLogger logger = LogManager.getLambdaLogger();
  * logger.trace(&quot;Some long-running operation returned {}&quot;, () -&gt; expensiveOperation());
  * </pre>
  */

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cf3ced44/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 7d72630..0678a6b 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -88,6 +88,14 @@
               Map, and data present in the event. Users can further customize the property providers by
               adding their own <a href="manual/lookups.html">Lookup</a> Plugin.
             </dd>
+            <dt>Java 8 Lambda Support</dt>
+            <dd>
+              Previously, if a log message was expensive to construct, you would often explicitly check if the
+              requested log level is enabled before constructing the message.
+              Client code running on Java 8 can benefit from Log4j's <a href="manual/api.html#LambdaSupport">lambda
+              support</a>. Since Log4j will not evaluate a lambda
+              expression if the requested log level is not enabled, the same effect can be achieved with less code.
+            </dd>
           </dl>
 
           <subsection name="Documentation">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cf3ced44/src/site/xdoc/manual/api.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/api.xml b/src/site/xdoc/manual/api.xml
index 4a60f5c..1783353 100644
--- a/src/site/xdoc/manual/api.xml
+++ b/src/site/xdoc/manual/api.xml
@@ -114,6 +114,29 @@ logger.debug("Long.MAX_VALUE = %,d", Long.MAX_VALUE);
 logger.debug("Opening connection to {}...", someDataSource);
 logger.printf(Level.INFO, "Logging in user %1$s with birthday %2$tm %2$te,%2$tY", user.getName(), user.getBirthdayCalendar());
 </pre>
+
+          <a name="LambdaSupport"/>
+            <h4>Java 8 lambda support for lazy logging</h4>
+            <p>
+              The <code>LambdaLogger</code> interface extends <code>Logger</code> to add support for lambda expressions.
+              This logger allows client code to lazily log messages without explicitly checking if the requested log
+              level is enabled. For example, previously you would write:
+            </p>
+            <pre class="prettyprint linenums">// pre-Java 8 style optimization: explicitly check the log level
+// to make sure the expensiveOperation() method is only called if necessary
+Logger logger = LogManager.getLogger();
+if (logger.isTraceEnabled()) {
+    logger.trace(&quot;Some long-running operation returned {}&quot;, expensiveOperation());
+}</pre>
+            <p>
+              With Java 8 and the <code>LambdaLogger</code> interface, you can achieve the same effect by using a
+              lambda expression. You no longer need to explicitly check the log level:
+            </p>
+            <pre class="prettyprint linenums">// Java-8 style optimization: no need to explicitly check the log level:
+// the lambda expression is not evaluated if the TRACE level is not enabled
+LambdaLogger logger = LogManager.getLambdaLogger();
+logger.trace(&quot;Some long-running operation returned {}&quot;, () -> expensiveOperation());</pre>
+
           <h4>Logger Names</h4>
             <p>
               Most logging implementations use a hierarchical scheme for matching logger names with logging

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cf3ced44/src/site/xdoc/manual/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/index.xml b/src/site/xdoc/manual/index.xml
index 54c47ec..35c0077 100644
--- a/src/site/xdoc/manual/index.xml
+++ b/src/site/xdoc/manual/index.xml
@@ -104,6 +104,9 @@
               do not require a class name to be specified.</li>
             <li>Support for <a href="customloglevels.html">custom log levels</a>.
               Custom log levels can be defined in code or in configuration.</li>
+            <li>Support for <a href="api.html#LambdaSupport">lambda expressions</a>.
+              Client code running on Java 8 can use lambda expressions to lazily construct a log message only if
+              the requested log level is enabled. Explicit level checks are not needed, resulting in cleaner code.</li>
             <li>Support for <a href="messages.html">Message objects</a>. Messages allow support for interesting and
               complex constructs to be passed through the logging system and be efficiently
               manipulated. Users are free to create their own


[03/11] logging-log4j2 git commit: LOG4J2-599 organized imports

Posted by rp...@apache.org.
LOG4J2-599 organized imports

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

Branch: refs/heads/master
Commit: faa36c3652b1e49b26eaf2433819805b5d8f9211
Parents: 914b291
Author: rpopma <rp...@apache.org>
Authored: Thu Aug 6 23:51:58 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Aug 6 23:51:58 2015 +0900

----------------------------------------------------------------------
 log4j-api/src/main/java/org/apache/logging/log4j/Logger.java | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/faa36c36/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 9c6d000..8f9c837 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
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j;
 
-import java.util.concurrent.Callable;
-
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.MessageFactory;
 


[05/11] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-599-LambdaSupport

Posted by rp...@apache.org.
Merge branch 'master' into LOG4J2-599-LambdaSupport

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

Branch: refs/heads/master
Commit: 63a325d97cc36fa5f26c2f172a7e0034598d959d
Parents: cf3ced4 acfd7d3
Author: rpopma <rp...@apache.org>
Authored: Sat Aug 8 16:35:46 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Aug 8 16:35:46 2015 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/LevelLogger.java   | 442 -------------------
 .../log4j/perf/jmh/VarargsBenchmark.java        |  76 ++++
 log4j-samples/.gitignore                        |   1 +
 src/changes/changes.xml                         |   9 +-
 4 files changed, 83 insertions(+), 445 deletions(-)
----------------------------------------------------------------------



[08/11] logging-log4j2 git commit: LOG4J2-599 Log4j should not attempt to catch exceptions thrown by client code lambda expressions

Posted by rp...@apache.org.
LOG4J2-599 Log4j should not attempt to catch exceptions thrown by client
code lambda expressions

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

Branch: refs/heads/master
Commit: 2d924ce7d41ee2a53e940d7beef03cb28a993056
Parents: 12be6d8
Author: rpopma <rp...@apache.org>
Authored: Mon Aug 10 00:29:38 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Aug 10 00:29:38 2015 +0900

----------------------------------------------------------------------
 .../apache/logging/log4j/util/LambdaUtil.java   |  8 +----
 .../logging/log4j/util/LambdaUtilTest.java      | 31 +++++++-------------
 2 files changed, 12 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2d924ce7/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
index 954886b..4a7479e 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
@@ -52,13 +52,7 @@ public class LambdaUtil {
         if (supplier == null) {
             return null;
         }
-        Object result = null;
-        try {
-            result = supplier.get();
-        } catch (Exception ex) {
-            result = ex;
-        }
-        return result;
+        return supplier.get();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2d924ce7/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
index 946c63c..a97ca28 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
@@ -62,26 +62,22 @@ public class LambdaUtilTest {
         assertNull(actual);
     }
 
-    @Test
+    @Test(expected = RuntimeException.class)
     public void testGetSupplierExceptionIfSupplierThrowsException() {
-        final RuntimeException expected = new RuntimeException();
-        final Object actual = LambdaUtil.get(new Supplier<String>() {
+        LambdaUtil.get(new Supplier<String>() {
             public String get() {
-                throw expected;
+                throw new RuntimeException();
             }
         });
-        assertSame(expected, actual);
     }
 
-    @Test
+    @Test(expected = RuntimeException.class)
     public void testGetMessageSupplierExceptionIfSupplierThrowsException() {
-        final RuntimeException expected = new RuntimeException();
-        final Object actual = LambdaUtil.get(new MessageSupplier() {
+        LambdaUtil.get(new MessageSupplier() {
             public Message get() {
-                throw expected;
+                throw new RuntimeException();
             }
         });
-        assertSame(expected, actual);
     }
 
     @Test
@@ -122,25 +118,20 @@ public class LambdaUtilTest {
         }
     }
 
-    @Test
-    public void testGetAllReturnsExceptionsIfSuppliersThrowsException() {
-        final RuntimeException expected1 = new RuntimeException();
+    @Test(expected = RuntimeException.class)
+    public void testGetAllThrowsExceptionIfAnyOfTheSuppliersThrowsException() {
         Supplier<String> function1 = new Supplier<String>() {
             public String get() {
-                throw expected1;
+                return "abc";
             }
         };
-        final RuntimeException expected2 = new RuntimeException();
         Supplier<String> function2 = new Supplier<String>() {
             public String get() {
-                throw expected2;
+                throw new RuntimeException();
             }
         };
 
         Supplier<?>[] functions = { function1, function2 };
-        final Object[] actual = LambdaUtil.getAll(functions);
-        assertEquals(actual.length, functions.length);
-        assertSame(expected1, actual[0]);
-        assertSame(expected2, actual[1]);
+        LambdaUtil.getAll(functions);
     }
 }


[02/11] logging-log4j2 git commit: LOG4J2-599 - revert changes to Logger and ExtendedLogger interfaces; - add new interfaces LambdaLogger and ExtendedLambdaLogger that inherit from the existing interfaces and add lambda support - AbstractLogger implement

Posted by rp...@apache.org.
LOG4J2-599 
- revert changes to Logger and ExtendedLogger interfaces; 
- add new interfaces LambdaLogger and ExtendedLambdaLogger that inherit
from the existing interfaces and add lambda support
- AbstractLogger implements the new lambda support interfaces
- added factory methods to obtain LambdaLoggers from LogManager
- JUnit test for LambdaUtil

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

Branch: refs/heads/master
Commit: 914b291ce46a8224a2228c92740c51621b5b76b1
Parents: bccedde
Author: rpopma <rp...@apache.org>
Authored: Thu Aug 6 23:50:23 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Aug 6 23:50:23 2015 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/LambdaLogger.java  | 429 +++++++++++++++++++
 .../org/apache/logging/log4j/LogManager.java    | 128 +++++-
 .../java/org/apache/logging/log4j/Logger.java   |  14 -
 .../logging/log4j/spi/AbstractLogger.java       | 221 +++++++++-
 .../logging/log4j/spi/ExtendedLambdaLogger.java |  56 +++
 .../logging/log4j/spi/ExtendedLogger.java       |  26 --
 .../logging/log4j/util/LambdaUtilTest.java      | 119 +++++
 7 files changed, 926 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914b291c/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
new file mode 100644
index 0000000..ea08013
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/LambdaLogger.java
@@ -0,0 +1,429 @@
+/*
+ * 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;
+
+import java.util.concurrent.Callable;
+
+/**
+ * Extends the {@code Logger} interface with support for lambda expressions.
+ * <p>
+ * This logger allows client code to lazily log messages without explicitly checking if the requested log level is
+ * enabled. For example, previously one would write:
+ * 
+ * <pre>
+ * // pre-Java 8 style optimization: explicitly check the log level
+ * // to make sure the expensiveOperation() method is only called if necessary
+ * Logger logger = LogManager.getLogger();
+ * if (logger.isTraceEnabled()) {
+ *     logger.trace(&quot;Some long-running operation returned {}&quot;, expensiveOperation());
+ * }
+ * </pre>
+ * <p>
+ * With Java 8 and the {@code LambdaLogger} interface, one can achieve the same effect by using a lambda expression:
+ * 
+ * <pre>
+ * // Java-8 style optimization: no need to explicitly check the log level:
+ * // the lambda expression is not evaluated if the TRACE level is not enabled
+ * Logger2 logger = LogManager.getLambdaLogger();
+ * logger.trace(&quot;Some long-running operation returned {}&quot;, () -&gt; expensiveOperation());
+ * </pre>
+ */
+public interface LambdaLogger extends Logger {
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void debug(Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void debug(Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level with
+     * the specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void debug(Marker marker, Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void debug(Marker marker, Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#DEBUG
+     * DEBUG} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void debug(Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#DEBUG
+     * DEBUG} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void debug(String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void error(Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void error(Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#ERROR ERROR} level with
+     * the specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void error(Marker marker, Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#ERROR ERROR} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void error(Marker marker, Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#ERROR
+     * ERROR} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void error(Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#ERROR
+     * ERROR} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void error(String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void fatal(Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void fatal(Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#FATAL FATAL} level with
+     * the specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void fatal(Marker marker, Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#FATAL FATAL} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void fatal(Marker marker, Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#FATAL
+     * FATAL} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void fatal(Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#FATAL
+     * FATAL} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void fatal(String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void info(Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void info(Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#INFO INFO} level with the
+     * specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void info(Marker marker, Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#INFO INFO} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void info(Marker marker, Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#INFO
+     * INFO} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void info(Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#INFO
+     * INFO} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void info(String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the specified level.
+     *
+     * @param level the logging level
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void log(Level level, Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the specified level) including the stack log of
+     * the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param level the logging level
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack log.
+     */
+    void log(Level level, Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the specified level) with the specified Marker.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void log(Level level, Marker marker, Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the specified level) with the specified Marker and
+     * including the stack log of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void log(Level level, Marker marker, Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void log(Level level, Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the specified level.
+     *
+     * @param level the logging level
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void log(Level level, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void trace(Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void trace(Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#TRACE TRACE} level with
+     * the specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void trace(Marker marker, Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#TRACE TRACE} level) with the
+     * specified Marker and including the stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void trace(Marker marker, Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#TRACE
+     * TRACE} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void trace(Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#TRACE
+     * TRACE} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void trace(String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void warn(Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) including the
+     * stack warn of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack warn.
+     */
+    void warn(Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message which is only to be constructed if the logging level is the {@link Level#WARN WARN} level with the
+     * specified Marker.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     */
+    void warn(Marker marker, Callable<?> msgSupplier);
+
+    /**
+     * Logs a message (only to be constructed if the logging level is the {@link Level#WARN WARN} level) with the
+     * specified Marker and including the stack warn of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param marker the marker data specific to this log statement
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t A Throwable or null.
+     */
+    void warn(Marker marker, Callable<?> msgSupplier, Throwable t);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#WARN
+     * WARN} 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 paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void warn(Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message with parameters which are only to be constructed if the logging level is the {@link Level#WARN
+     * WARN} level.
+     *
+     * @param message the message to log; the format depends on the message factory.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void warn(String message, Callable<?>... paramSuppliers);
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914b291c/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
index d5ad911..f4aa848 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
@@ -416,6 +416,114 @@ public class LogManager {
     }
 
     /**
+     * Returns a LambdaLogger with the name of the calling class.
+     * @return The LambdaLogger for the calling class.
+     * @throws UnsupportedOperationException if the calling class cannot be determined.
+     */
+    public static LambdaLogger getLambdaLogger() {
+        return (LambdaLogger) getLogger(ReflectionUtil.getCallerClass(2));
+    }
+    
+    private static Class<?> callerClass(final Class<?> clazz) {
+        if (clazz != null) {
+            return clazz;
+        }
+        final Class<?> candidate = ReflectionUtil.getCallerClass(3);
+        if (candidate == null) {
+            throw new UnsupportedOperationException("No class provided, and an appropriate one cannot be found.");
+        }
+        return candidate;
+    }
+
+    /**
+     * Returns a LambdaLogger using the fully qualified name of the Class as the Logger name.
+     * @param clazz The Class whose name should be used as the Logger name. If null it will default to the calling
+     *              class.
+     * @return The LambdaLogger.
+     * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
+     */
+    public static LambdaLogger getLambdaLogger(final Class<?> clazz) {
+        final Class<?> cls = callerClass(clazz);
+        return (LambdaLogger) getContext(cls.getClassLoader(), false).getLogger(cls.getName());
+    }
+
+    /**
+     * Returns a LambdaLogger using the fully qualified name of the Class as the Logger name.
+     * @param clazz The Class whose name should be used as the Logger name. If null it will default to the calling
+     *              class.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
+     *                       the logger but will log a warning if mismatched.
+     * @return The LambdaLogger.
+     * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
+     */
+    public static LambdaLogger getLambdaLogger(final Class<?> clazz, final MessageFactory messageFactory) {
+        final Class<?> cls = callerClass(clazz);
+        return (LambdaLogger) getContext(cls.getClassLoader(), false).getLogger(cls.getName(), messageFactory);
+    }
+
+    /**
+     * Returns a LambdaLogger with the name of the calling class.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
+     *                       the logger but will log a warning if mismatched.
+     * @return The LambdaLogger for the calling class.
+     * @throws UnsupportedOperationException if the calling class cannot be determined.
+     */
+    public static LambdaLogger getLambdaLogger(final MessageFactory messageFactory) {
+        return (LambdaLogger) getLogger(ReflectionUtil.getCallerClass(2), messageFactory);
+    }
+
+    /**
+     * Returns a LambdaLogger using the fully qualified class name of the value as the Logger name.
+     * @param value The value whose class name should be used as the Logger name. If null the name of the calling
+     *              class will be used as the logger name.
+     * @return The LambdaLogger.
+     * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be determined.
+     */
+    public static LambdaLogger getLambdaLogger(final Object value) {
+        return (LambdaLogger) getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2));
+    }
+
+    /**
+     * Returns a LambdaLogger using the fully qualified class name of the value as the Logger name.
+     * @param value The value whose class name should be used as the Logger name. If null the name of the calling
+     *              class will be used as the logger name.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
+     *                       the logger but will log a warning if mismatched.
+     * @return The LambdaLogger.
+     * @throws UnsupportedOperationException if {@code value} is {@code null} and the calling class cannot be determined.
+     */
+    public static LambdaLogger getLambdaLogger(final Object value, final MessageFactory messageFactory) {
+        return (LambdaLogger) getLogger(value != null ? value.getClass() : ReflectionUtil.getCallerClass(2),
+                messageFactory);
+    }
+
+    /**
+     * Returns a LambdaLogger with the specified name.
+     *
+     * @param name The logger name. If null the name of the calling class will be used.
+     * @return The LambdaLogger.
+     * @throws UnsupportedOperationException if {@code name} is {@code null} and the calling class cannot be determined.
+     */
+    public static LambdaLogger getLambdaLogger(final String name) {
+        return (LambdaLogger) (name != null ? getContext(false).getLogger(name) : getLogger(
+                ReflectionUtil.getCallerClass(2)));
+    }
+
+    /**
+     * Returns a LambdaLogger with the specified name.
+     *
+     * @param name The logger name. If null the name of the calling class will be used.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent use does not change
+     *                       the logger but will log a warning if mismatched.
+     * @return The LambdaLogger.
+     * @throws UnsupportedOperationException if {@code name} is {@code null} and the calling class cannot be determined.
+     */
+    public static LambdaLogger getLambdaLogger(final String name, final MessageFactory messageFactory) {
+        return (LambdaLogger) (name != null ? getContext(false).getLogger(name, messageFactory) : getLogger(
+            ReflectionUtil.getCallerClass(2), messageFactory));
+    }
+
+    /**
      * Returns a Logger with the name of the calling class.
      * @return The Logger for the calling class.
      * @throws UnsupportedOperationException if the calling class cannot be determined.
@@ -432,14 +540,8 @@ public class LogManager {
      * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
      */
     public static Logger getLogger(final Class<?> clazz) {
-        if (clazz == null) {
-            final Class<?> candidate = ReflectionUtil.getCallerClass(2);
-            if (candidate == null) {
-                throw new UnsupportedOperationException("No class provided, and an appropriate one cannot be found.");
-            }
-            return getLogger(candidate);
-        }
-        return getContext(clazz.getClassLoader(), false).getLogger(clazz.getName());
+        final Class<?> cls = callerClass(clazz);
+        return getContext(cls.getClassLoader(), false).getLogger(cls.getName());
     }
 
     /**
@@ -452,14 +554,8 @@ public class LogManager {
      * @throws UnsupportedOperationException if {@code clazz} is {@code null} and the calling class cannot be determined.
      */
     public static Logger getLogger(final Class<?> clazz, final MessageFactory messageFactory) {
-        if (clazz == null) {
-            final Class<?> candidate = ReflectionUtil.getCallerClass(2);
-            if (candidate == null) {
-                throw new UnsupportedOperationException("No class provided, and an appropriate one cannot be found.");
-            }
-            return getLogger(candidate, messageFactory);
-        }
-        return getContext(clazz.getClassLoader(), false).getLogger(clazz.getName(), messageFactory);
+        final Class<?> cls = callerClass(clazz);
+        return getContext(cls.getClassLoader(), false).getLogger(cls.getName(), messageFactory);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914b291c/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 85364b3..9c6d000 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
@@ -185,20 +185,6 @@ public interface Logger {
     void debug(String message, Throwable t);
 
     /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level.
-     *
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     */
-    void debug(Callable<?> msgSupplier);
-
-    /**
-     * Logs a message which is only to be constructed if the logging level is the {@link Level#DEBUG DEBUG} level.
-     *
-     * @param paramSupplier An array of functions, which when called, produce the desired log message parameters.
-     */
-    void debug(String message, Callable<?>... paramSupplier);
-
-    /**
      * Logs entry to a method. Used when the method in question has no parameters or when the parameters should not be
      * logged.
      */

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914b291c/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
index 4eb4a50..95696af 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
@@ -32,7 +32,7 @@ import org.apache.logging.log4j.util.LambdaUtil;
 /**
  * Base implementation of a Logger. It is highly recommended that any Logger implementation extend this class.
  */
-public abstract class AbstractLogger implements ExtendedLogger, Serializable {
+public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializable {
 
     private static final long serialVersionUID = 2L;
 
@@ -220,16 +220,6 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
-    public void debug(Callable<?> msgSupplier) {
-        logIfEnabled(FQCN, Level.DEBUG, null, msgSupplier, null);
-    }
-
-    @Override
-    public void debug(String message, Callable<?>... paramSupplier) {
-        logIfEnabled(FQCN, Level.DEBUG, null, message, paramSupplier);
-    }
-
-    @Override
     public void debug(final Object message) {
         logIfEnabled(FQCN, Level.DEBUG, null, message, null);
     }
@@ -255,6 +245,36 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
+    public void debug(final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.DEBUG, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void debug(final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.DEBUG, null, msgSupplier, t);
+    }
+
+    @Override
+    public void debug(final Marker marker, final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.DEBUG, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void debug(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.DEBUG, marker, message, paramSuppliers);
+    }
+
+    @Override
+    public void debug(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.DEBUG, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void debug(final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.DEBUG, null, message, paramSuppliers);
+    }
+
+    @Override
     public void entry() {
         entry(FQCN);
     }
@@ -367,6 +387,36 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
+    public void error(final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.ERROR, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void error(final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.ERROR, null, msgSupplier, t);
+    }
+
+    @Override
+    public void error(final Marker marker, final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.ERROR, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void error(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.ERROR, marker, message, paramSuppliers);
+    }
+
+    @Override
+    public void error(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.ERROR, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void error(final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.ERROR, null, message, paramSuppliers);
+    }
+
+    @Override
     public void exit() {
         exit(FQCN, null);
     }
@@ -469,6 +519,36 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
+    public void fatal(final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.FATAL, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void fatal(final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.FATAL, null, msgSupplier, t);
+    }
+
+    @Override
+    public void fatal(final Marker marker, final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.FATAL, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void fatal(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.FATAL, marker, message, paramSuppliers);
+    }
+
+    @Override
+    public void fatal(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.FATAL, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void fatal(final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.FATAL, null, message, paramSuppliers);
+    }
+
+    @Override
     public MessageFactory getMessageFactory() {
         return messageFactory;
     }
@@ -549,6 +629,36 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
+    public void info(final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.INFO, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void info(final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.INFO, null, msgSupplier, t);
+    }
+
+    @Override
+    public void info(final Marker marker, final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.INFO, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void info(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.INFO, marker, message, paramSuppliers);
+    }
+
+    @Override
+    public void info(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.INFO, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void info(final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.INFO, null, message, paramSuppliers);
+    }
+
+    @Override
     public boolean isDebugEnabled() {
         return isEnabled(Level.DEBUG, null, null);
     }
@@ -691,6 +801,36 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
+    public void log(final Level level, final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, level, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void log(final Level level, final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, level, null, msgSupplier, t);
+    }
+
+    @Override
+    public void log(final Level level, final Marker marker, final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, level, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void log(final Level level, final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, level, marker, message, paramSuppliers);
+    }
+
+    @Override
+    public void log(final Level level, final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, level, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void log(final Level level, final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, level, null, message, paramSuppliers);
+    }
+
+    @Override
     public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final Message msg,
             final Throwable t) {
         if (isEnabled(level, marker, msg, t)) {
@@ -900,6 +1040,36 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
     }
 
     @Override
+    public void trace(final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.TRACE, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void trace(final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.TRACE, null, msgSupplier, t);
+    }
+
+    @Override
+    public void trace(final Marker marker, final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.TRACE, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void trace(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.TRACE, marker, message, paramSuppliers);
+    }
+
+    @Override
+    public void trace(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.TRACE, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void trace(final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.TRACE, null, message, paramSuppliers);
+    }
+
+    @Override
     public void warn(final Marker marker, final Message msg, final Throwable t) {
         logIfEnabled(FQCN, Level.WARN, marker, msg, t);
     }
@@ -969,4 +1139,33 @@ public abstract class AbstractLogger implements ExtendedLogger, Serializable {
         logIfEnabled(FQCN, Level.WARN, null, message, t);
     }
 
+    @Override
+    public void warn(final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.WARN, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void warn(final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.WARN, null, msgSupplier, t);
+    }
+
+    @Override
+    public void warn(final Marker marker, final Callable<?> msgSupplier) {
+        logIfEnabled(FQCN, Level.WARN, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void warn(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.WARN, marker, message, paramSuppliers);
+    }
+
+    @Override
+    public void warn(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.WARN, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void warn(final String message, final Callable<?>... paramSuppliers) {
+        logIfEnabled(FQCN, Level.WARN, null, message, paramSuppliers);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914b291c/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLambdaLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLambdaLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLambdaLogger.java
new file mode 100644
index 0000000..5e61f62
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLambdaLogger.java
@@ -0,0 +1,56 @@
+/*
+ * 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.concurrent.Callable;
+
+import org.apache.logging.log4j.LambdaLogger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+
+/**
+ * Extends the {@code LambdaLogger} interface with methods that facilitate implementing or extending
+ * {@code LambdaLogger}s. Users should not need to use this interface.
+ */
+public interface ExtendedLambdaLogger extends ExtendedLogger, LambdaLogger {
+
+    /**
+     * Logs a message whose parameters are only to be constructed if the specified level is active.
+     * 
+     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
+     *            method when location information needs to be logged.
+     * @param level The logging Level to check.
+     * @param marker A Marker or null.
+     * @param message The message format.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void logIfEnabled(String fqcn, Level level, Marker marker, String message, Callable<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the specified level is active.
+     * 
+     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
+     *            method when location information needs to be logged.
+     * @param level The logging Level to check.
+     * @param marker A Marker or null.
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void logIfEnabled(String fqcn, Level level, Marker marker, Callable<?> msgSupplier, Throwable t);
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914b291c/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java
index 1771f37..8a36c57 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger.java
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.spi;
 
-import java.util.concurrent.Callable;
-
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.Marker;
@@ -96,18 +94,6 @@ public interface ExtendedLogger extends Logger {
     void logIfEnabled(String fqcn, Level level, Marker marker, Message message, Throwable t);
 
     /**
-     * Logs a message which is only to be constructed if the specified level is active.
-     * 
-     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
-     *            method when location information needs to be logged.
-     * @param level The logging Level to check.
-     * @param marker A Marker or null.
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack trace.
-     */
-    void logIfEnabled(String fqcn, Level level, Marker marker, Callable<?> msgSupplier, Throwable t);
-
-    /**
      * Logs a message if the specified level is active.
      * 
      * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
@@ -155,18 +141,6 @@ public interface ExtendedLogger extends Logger {
     void logIfEnabled(String fqcn, Level level, Marker marker, String message, Object... params);
 
     /**
-     * Logs a message which is only to be constructed if the specified level is active.
-     * 
-     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
-     *            method when location information needs to be logged.
-     * @param level The logging Level to check.
-     * @param marker A Marker or null.
-     * @param message The message format.
-     * @param paramSupplier An array of functions, which when called, produce the desired log message parameters.
-     */
-    void logIfEnabled(String fqcn, Level level, Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
      * Always logs a message at the specified level. It is the responsibility of the caller to ensure the specified
      * level is enabled.
      * 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914b291c/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
new file mode 100644
index 0000000..edfc50e
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.util;
+
+import java.util.concurrent.Callable;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests the LambdaUtil class.
+ */
+public class LambdaUtilTest {
+
+    @Test
+    public void testCallReturnsResultOfCallable() {
+        final String expected = "result";
+        final Object actual = LambdaUtil.call(new Callable<String>() {
+            public String call() {
+                return expected;
+            }
+        });
+        assertSame(expected, actual);
+    }
+
+    @Test
+    public void testCallReturnsNullIfCallableNull() {
+        final Object actual = LambdaUtil.call(null);
+        assertNull(actual);
+    }
+
+    @Test
+    public void testCallReturnsExceptionIfCallableThrowsException() {
+        final Exception expected = new RuntimeException();
+        final Object actual = LambdaUtil.call(new Callable<String>() {
+            public String call() throws Exception{
+                throw expected;
+            }
+        });
+        assertSame(expected, actual);
+    }
+
+
+    @Test
+    public void testCallAllReturnsResultOfCallables() {
+        final String expected1 = "result1";
+        Callable<String> function1 = new Callable<String>() {
+            public String call() {
+                return expected1;
+            }
+        };
+        final String expected2 = "result2";
+        Callable<String> function2 = new Callable<String>() {
+            public String call() {
+                return expected2;
+            }
+        };
+        
+        Callable<?>[] functions = {function1, function2};
+        final Object[] actual = LambdaUtil.callAll(functions);
+        assertEquals(actual.length, functions.length);
+        assertSame(expected1, actual[0]);
+        assertSame(expected2, actual[1]);
+    }
+
+    @Test
+    public void testCallAllReturnsNullArrayIfCallablesArrayNull() {
+        final Object[] actual = LambdaUtil.callAll((Callable<?>[]) null);
+        assertNull(actual);
+    }
+
+    @Test
+    public void testCallAllReturnsNullElementsIfCallableArrayContainsNulls() {
+        final Callable<?>[] functions = new Callable[3];
+        final Object[] actual = LambdaUtil.callAll(functions);
+        assertEquals(actual.length, functions.length);
+        for (Object object : actual) {
+            assertNull(object);
+        }
+    }
+
+    @Test
+    public void testCallAllReturnsExceptionsIfCallablesThrowsException() {
+        final Exception expected1 = new RuntimeException();
+        Callable<String> function1 = new Callable<String>() {
+            public String call() throws Exception{
+                throw expected1;
+            }
+        };
+        final Exception expected2 = new RuntimeException();
+        Callable<String> function2 = new Callable<String>() {
+            public String call() throws Exception{
+                throw expected2;
+            }
+        };
+        
+        Callable<?>[] functions = {function1, function2};
+        final Object[] actual = LambdaUtil.callAll(functions);
+        assertEquals(actual.length, functions.length);
+        assertSame(expected1, actual[0]);
+        assertSame(expected2, actual[1]);
+    }
+}


[11/11] logging-log4j2 git commit: Merge branch 'LOG4J2-599-LambdaSupport'

Posted by rp...@apache.org.
Merge branch 'LOG4J2-599-LambdaSupport'

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

Branch: refs/heads/master
Commit: b0e473bb20d84e452172df05e86436f97c51113d
Parents: c49391f bb6cb77
Author: rpopma <rp...@apache.org>
Authored: Mon Aug 10 01:15:17 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Aug 10 01:15:17 2015 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/LogManager.java    |  136 +-
 .../java/org/apache/logging/log4j/Logger2.java  |  738 ++++++++++
 .../logging/log4j/spi/AbstractLogger.java       |  401 +++++-
 .../logging/log4j/spi/ExtendedLogger2.java      |   68 +
 .../apache/logging/log4j/util/LambdaUtil.java   |   70 +
 .../logging/log4j/util/MessageSupplier.java     |   40 +
 .../org/apache/logging/log4j/util/Supplier.java |   40 +
 .../org/apache/logging/log4j/Logger2Test.java   | 1257 ++++++++++++++++++
 .../logging/log4j/util/LambdaUtilTest.java      |  137 ++
 src/site/xdoc/index.xml                         |    8 +
 src/site/xdoc/manual/api.xml                    |   23 +
 src/site/xdoc/manual/index.xml                  |    3 +
 12 files changed, 2899 insertions(+), 22 deletions(-)
----------------------------------------------------------------------



Re: [10/11] logging-log4j2 git commit: LOG4J2-599 small test improvements

Posted by Remko Popma <re...@gmail.com>.
Thanks for fixing the @since tag.
About the Javadoc for the new interfaces, I was "heavily inspired" by
java.util.function.Supplier. I noticed this but if Oracle doesn't pay
attention to this internally then hey...

On Mon, Aug 10, 2015 at 1:20 AM, Gary Gregory <ga...@gmail.com>
wrote:

> Ironically, the Javadoc for org.apache.logging.log4j.util.Supplier are not
> Java 8 XHTML...
>
> Gary
>
> On Sun, Aug 9, 2015 at 9:19 AM, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> "@since log4j-2.4" should be "@since 2.4"
>>
>> Gary
>>
>> ---------- Forwarded message ----------
>> From: <rp...@apache.org>
>> Date: Sun, Aug 9, 2015 at 9:17 AM
>> Subject: [10/11] logging-log4j2 git commit: LOG4J2-599 small test
>> improvements
>> To: commits@logging.apache.org
>>
>>
>> LOG4J2-599 small test improvements
>>
>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>> Commit:
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/bb6cb775
>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/bb6cb775
>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/bb6cb775
>>
>> Branch: refs/heads/master
>> Commit: bb6cb775099cfa2a4afbd08e28113a0c24bbd07b
>> Parents: b3ce3fc
>> Author: rpopma <rp...@apache.org>
>> Authored: Mon Aug 10 00:58:25 2015 +0900
>> Committer: rpopma <rp...@apache.org>
>> Committed: Mon Aug 10 00:58:25 2015 +0900
>>
>> ----------------------------------------------------------------------
>>  .../src/test/java/org/apache/logging/log4j/Logger2Test.java    | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bb6cb775/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
>> b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
>> index 7509fc4..2b0247c 100644
>> --- a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
>> +++ b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
>> @@ -52,7 +52,7 @@ public class Logger2Test {
>>          }
>>      }
>>
>> -    class Logger2Impl extends AbstractLogger {
>> +    private static class Logger2Impl extends AbstractLogger {
>>          private static final long serialVersionUID = 1L;
>>
>>          boolean enabled = true;
>> @@ -110,7 +110,7 @@ public class Logger2Test {
>>      final Throwable throwable = new Error("I'm Bad");
>>      final Marker marker = MarkerManager.getMarker("test");
>>
>> -    class MyMessageSupplier implements MessageSupplier {
>> +    private class MyMessageSupplier implements MessageSupplier {
>>          public boolean invoked = false;
>>
>>          @Override
>> @@ -122,7 +122,7 @@ public class Logger2Test {
>>
>>      final MyMessageSupplier messageSupplier = new MyMessageSupplier();
>>
>> -    class MySupplier implements Supplier<String> {
>> +    private class MySupplier implements Supplier<String> {
>>          public boolean invoked = false;
>>
>>          @Override
>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>

Re: [10/11] logging-log4j2 git commit: LOG4J2-599 small test improvements

Posted by Gary Gregory <ga...@gmail.com>.
Ironically, the Javadoc for org.apache.logging.log4j.util.Supplier are not
Java 8 XHTML...

Gary

On Sun, Aug 9, 2015 at 9:19 AM, Gary Gregory <ga...@gmail.com> wrote:

> "@since log4j-2.4" should be "@since 2.4"
>
> Gary
>
> ---------- Forwarded message ----------
> From: <rp...@apache.org>
> Date: Sun, Aug 9, 2015 at 9:17 AM
> Subject: [10/11] logging-log4j2 git commit: LOG4J2-599 small test
> improvements
> To: commits@logging.apache.org
>
>
> LOG4J2-599 small test improvements
>
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/bb6cb775
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/bb6cb775
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/bb6cb775
>
> Branch: refs/heads/master
> Commit: bb6cb775099cfa2a4afbd08e28113a0c24bbd07b
> Parents: b3ce3fc
> Author: rpopma <rp...@apache.org>
> Authored: Mon Aug 10 00:58:25 2015 +0900
> Committer: rpopma <rp...@apache.org>
> Committed: Mon Aug 10 00:58:25 2015 +0900
>
> ----------------------------------------------------------------------
>  .../src/test/java/org/apache/logging/log4j/Logger2Test.java    | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bb6cb775/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
> ----------------------------------------------------------------------
> diff --git
> a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
> b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
> index 7509fc4..2b0247c 100644
> --- a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
> +++ b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
> @@ -52,7 +52,7 @@ public class Logger2Test {
>          }
>      }
>
> -    class Logger2Impl extends AbstractLogger {
> +    private static class Logger2Impl extends AbstractLogger {
>          private static final long serialVersionUID = 1L;
>
>          boolean enabled = true;
> @@ -110,7 +110,7 @@ public class Logger2Test {
>      final Throwable throwable = new Error("I'm Bad");
>      final Marker marker = MarkerManager.getMarker("test");
>
> -    class MyMessageSupplier implements MessageSupplier {
> +    private class MyMessageSupplier implements MessageSupplier {
>          public boolean invoked = false;
>
>          @Override
> @@ -122,7 +122,7 @@ public class Logger2Test {
>
>      final MyMessageSupplier messageSupplier = new MyMessageSupplier();
>
> -    class MySupplier implements Supplier<String> {
> +    private class MySupplier implements Supplier<String> {
>          public boolean invoked = false;
>
>          @Override
>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Fwd: [10/11] logging-log4j2 git commit: LOG4J2-599 small test improvements

Posted by Gary Gregory <ga...@gmail.com>.
"@since log4j-2.4" should be "@since 2.4"

Gary

---------- Forwarded message ----------
From: <rp...@apache.org>
Date: Sun, Aug 9, 2015 at 9:17 AM
Subject: [10/11] logging-log4j2 git commit: LOG4J2-599 small test
improvements
To: commits@logging.apache.org


LOG4J2-599 small test improvements

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

Branch: refs/heads/master
Commit: bb6cb775099cfa2a4afbd08e28113a0c24bbd07b
Parents: b3ce3fc
Author: rpopma <rp...@apache.org>
Authored: Mon Aug 10 00:58:25 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Aug 10 00:58:25 2015 +0900

----------------------------------------------------------------------
 .../src/test/java/org/apache/logging/log4j/Logger2Test.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bb6cb775/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
----------------------------------------------------------------------
diff --git
a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
index 7509fc4..2b0247c 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
@@ -52,7 +52,7 @@ public class Logger2Test {
         }
     }

-    class Logger2Impl extends AbstractLogger {
+    private static class Logger2Impl extends AbstractLogger {
         private static final long serialVersionUID = 1L;

         boolean enabled = true;
@@ -110,7 +110,7 @@ public class Logger2Test {
     final Throwable throwable = new Error("I'm Bad");
     final Marker marker = MarkerManager.getMarker("test");

-    class MyMessageSupplier implements MessageSupplier {
+    private class MyMessageSupplier implements MessageSupplier {
         public boolean invoked = false;

         @Override
@@ -122,7 +122,7 @@ public class Logger2Test {

     final MyMessageSupplier messageSupplier = new MyMessageSupplier();

-    class MySupplier implements Supplier<String> {
+    private class MySupplier implements Supplier<String> {
         public boolean invoked = false;

         @Override




-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

[10/11] logging-log4j2 git commit: LOG4J2-599 small test improvements

Posted by rp...@apache.org.
LOG4J2-599 small test improvements

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

Branch: refs/heads/master
Commit: bb6cb775099cfa2a4afbd08e28113a0c24bbd07b
Parents: b3ce3fc
Author: rpopma <rp...@apache.org>
Authored: Mon Aug 10 00:58:25 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Aug 10 00:58:25 2015 +0900

----------------------------------------------------------------------
 .../src/test/java/org/apache/logging/log4j/Logger2Test.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bb6cb775/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
index 7509fc4..2b0247c 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
@@ -52,7 +52,7 @@ public class Logger2Test {
         }
     }
 
-    class Logger2Impl extends AbstractLogger {
+    private static class Logger2Impl extends AbstractLogger {
         private static final long serialVersionUID = 1L;
 
         boolean enabled = true;
@@ -110,7 +110,7 @@ public class Logger2Test {
     final Throwable throwable = new Error("I'm Bad");
     final Marker marker = MarkerManager.getMarker("test");
 
-    class MyMessageSupplier implements MessageSupplier {
+    private class MyMessageSupplier implements MessageSupplier {
         public boolean invoked = false;
 
         @Override
@@ -122,7 +122,7 @@ public class Logger2Test {
 
     final MyMessageSupplier messageSupplier = new MyMessageSupplier();
 
-    class MySupplier implements Supplier<String> {
+    private class MySupplier implements Supplier<String> {
         public boolean invoked = false;
 
         @Override


[06/11] logging-log4j2 git commit: LOG4J2-599 log4j lambda support - Renamed LambdaLogger to Logger2 - Renamed ExtendedLambdaLogger to ExtendedLogger2 - Renamed LogManager#getLambdaLogger methods to #getLogger2 - Introduced custom functional interface Su

Posted by rp...@apache.org.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
index 95696af..641e36b 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
@@ -17,7 +17,6 @@
 package org.apache.logging.log4j.spi;
 
 import java.io.Serializable;
-import java.util.concurrent.Callable;
 
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
@@ -28,11 +27,13 @@ import org.apache.logging.log4j.message.ParameterizedMessageFactory;
 import org.apache.logging.log4j.message.StringFormattedMessage;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.LambdaUtil;
+import org.apache.logging.log4j.util.MessageSupplier;
+import org.apache.logging.log4j.util.Supplier;
 
 /**
  * Base implementation of a Logger. It is highly recommended that any Logger implementation extend this class.
  */
-public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializable {
+public abstract class AbstractLogger implements ExtendedLogger2, Serializable {
 
     private static final long serialVersionUID = 2L;
 
@@ -245,36 +246,56 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
-    public void debug(final Callable<?> msgSupplier) {
+    public void debug(final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.DEBUG, null, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void debug(final Callable<?> msgSupplier, final Throwable t) {
+    public void debug(final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.DEBUG, null, msgSupplier, t);
     }
 
     @Override
-    public void debug(final Marker marker, final Callable<?> msgSupplier) {
+    public void debug(final Marker marker, final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.DEBUG, marker, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void debug(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+    public void debug(final Marker marker, final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.DEBUG, marker, message, paramSuppliers);
     }
 
     @Override
-    public void debug(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+    public void debug(final Marker marker, final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.DEBUG, marker, msgSupplier, t);
     }
 
     @Override
-    public void debug(final String message, final Callable<?>... paramSuppliers) {
+    public void debug(final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.DEBUG, null, message, paramSuppliers);
     }
 
     @Override
+    public void debug(final Marker marker, final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.DEBUG, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void debug(final Marker marker, final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.DEBUG, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void debug(final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.DEBUG, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void debug(final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.DEBUG, null, msgSupplier, t);
+    }
+
+    @Override
     public void entry() {
         entry(FQCN);
     }
@@ -387,36 +408,56 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
-    public void error(final Callable<?> msgSupplier) {
+    public void error(final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.ERROR, null, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void error(final Callable<?> msgSupplier, final Throwable t) {
+    public void error(final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.ERROR, null, msgSupplier, t);
     }
 
     @Override
-    public void error(final Marker marker, final Callable<?> msgSupplier) {
+    public void error(final Marker marker, final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.ERROR, marker, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void error(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+    public void error(final Marker marker, final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.ERROR, marker, message, paramSuppliers);
     }
 
     @Override
-    public void error(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+    public void error(final Marker marker, final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.ERROR, marker, msgSupplier, t);
     }
 
     @Override
-    public void error(final String message, final Callable<?>... paramSuppliers) {
+    public void error(final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.ERROR, null, message, paramSuppliers);
     }
 
     @Override
+    public void error(final Marker marker, final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.ERROR, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void error(final Marker marker, final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.ERROR, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void error(final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.ERROR, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void error(final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.ERROR, null, msgSupplier, t);
+    }
+
+    @Override
     public void exit() {
         exit(FQCN, null);
     }
@@ -519,36 +560,56 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
-    public void fatal(final Callable<?> msgSupplier) {
+    public void fatal(final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.FATAL, null, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void fatal(final Callable<?> msgSupplier, final Throwable t) {
+    public void fatal(final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.FATAL, null, msgSupplier, t);
     }
 
     @Override
-    public void fatal(final Marker marker, final Callable<?> msgSupplier) {
+    public void fatal(final Marker marker, final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.FATAL, marker, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void fatal(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+    public void fatal(final Marker marker, final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.FATAL, marker, message, paramSuppliers);
     }
 
     @Override
-    public void fatal(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+    public void fatal(final Marker marker, final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.FATAL, marker, msgSupplier, t);
     }
 
     @Override
-    public void fatal(final String message, final Callable<?>... paramSuppliers) {
+    public void fatal(final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.FATAL, null, message, paramSuppliers);
     }
 
     @Override
+    public void fatal(final Marker marker, final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.FATAL, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void fatal(final Marker marker, final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.FATAL, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void fatal(final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.FATAL, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void fatal(final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.FATAL, null, msgSupplier, t);
+    }
+
+    @Override
     public MessageFactory getMessageFactory() {
         return messageFactory;
     }
@@ -629,36 +690,56 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
-    public void info(final Callable<?> msgSupplier) {
+    public void info(final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.INFO, null, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void info(final Callable<?> msgSupplier, final Throwable t) {
+    public void info(final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.INFO, null, msgSupplier, t);
     }
 
     @Override
-    public void info(final Marker marker, final Callable<?> msgSupplier) {
+    public void info(final Marker marker, final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.INFO, marker, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void info(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+    public void info(final Marker marker, final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.INFO, marker, message, paramSuppliers);
     }
 
     @Override
-    public void info(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+    public void info(final Marker marker, final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.INFO, marker, msgSupplier, t);
     }
 
     @Override
-    public void info(final String message, final Callable<?>... paramSuppliers) {
+    public void info(final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.INFO, null, message, paramSuppliers);
     }
 
     @Override
+    public void info(final Marker marker, final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.INFO, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void info(final Marker marker, final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.INFO, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void info(final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.INFO, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void info(final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.INFO, null, msgSupplier, t);
+    }
+
+    @Override
     public boolean isDebugEnabled() {
         return isEnabled(Level.DEBUG, null, null);
     }
@@ -801,36 +882,56 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
-    public void log(final Level level, final Callable<?> msgSupplier) {
+    public void log(final Level level, final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, level, null, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void log(final Level level, final Callable<?> msgSupplier, final Throwable t) {
+    public void log(final Level level, final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, level, null, msgSupplier, t);
     }
 
     @Override
-    public void log(final Level level, final Marker marker, final Callable<?> msgSupplier) {
+    public void log(final Level level, final Marker marker, final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, level, marker, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void log(final Level level, final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+    public void log(final Level level, final Marker marker, final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, level, marker, message, paramSuppliers);
     }
 
     @Override
-    public void log(final Level level, final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+    public void log(final Level level, final Marker marker, final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, level, marker, msgSupplier, t);
     }
 
     @Override
-    public void log(final Level level, final String message, final Callable<?>... paramSuppliers) {
+    public void log(final Level level, final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, level, null, message, paramSuppliers);
     }
 
     @Override
+    public void log(final Level level, final Marker marker, final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, level, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void log(final Level level, final Marker marker, final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, level, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void log(final Level level, final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, level, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void log(final Level level, final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, level, null, msgSupplier, t);
+    }
+
+    @Override
     public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final Message msg,
             final Throwable t) {
         if (isEnabled(level, marker, msg, t)) {
@@ -839,6 +940,14 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
+    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, 
+            final MessageSupplier msgSupplier, final Throwable t) {
+        if (isEnabled(level, marker, msgSupplier, t)) {
+            logMessage(fqcn, level, marker, msgSupplier, t);
+        }
+    }
+
+    @Override
     public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final Object message,
             final Throwable t) {
         if (isEnabled(level, marker, message, t)) {
@@ -847,7 +956,7 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
-    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final Callable<?> msgSupplier,
+    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final Supplier<?> msgSupplier,
             final Throwable t) {
         if (isEnabled(level, marker, msgSupplier, t)) {
             logMessage(fqcn, level, marker, msgSupplier, t);
@@ -863,7 +972,7 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
 
     @Override
     public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final String message,
-            final Callable<?>... paramSuppliers) {
+            final Supplier<?>... paramSuppliers) {
         if (isEnabled(level, marker, message)) {
             logMessage(fqcn, level, marker, message, paramSuppliers);
         }
@@ -890,9 +999,15 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
         logMessage(fqcn, level, marker, messageFactory.newMessage(message), t);
     }
 
-    protected void logMessage(final String fqcn, final Level level, final Marker marker, final Callable<?> msgSupplier,
+    protected void logMessage(final String fqcn, final Level level, final Marker marker,
+            final MessageSupplier msgSupplier, final Throwable t) {
+        Message message = LambdaUtil.get(msgSupplier);
+        logMessage(fqcn, level, marker, message, t);
+    }
+
+    protected void logMessage(final String fqcn, final Level level, final Marker marker, final Supplier<?> msgSupplier,
             final Throwable t) {
-        Object message = LambdaUtil.call(msgSupplier);
+        Object message = LambdaUtil.get(msgSupplier);
         logMessage(fqcn, level, marker, messageFactory.newMessage(message), t);
     }
 
@@ -913,8 +1028,8 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     protected void logMessage(final String fqcn, final Level level, final Marker marker, final String message,
-            final Callable<?>... paramSuppliers) {
-        final Message msg = messageFactory.newMessage(message, LambdaUtil.callAll(paramSuppliers));
+            final Supplier<?>... paramSuppliers) {
+        final Message msg = messageFactory.newMessage(message, LambdaUtil.getAll(paramSuppliers));
         logMessage(fqcn, level, marker, msg, msg.getThrowable());
     }
 
@@ -1035,41 +1150,61 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
-    public void warn(final Marker marker, final Message msg) {
-        logIfEnabled(FQCN, Level.WARN, marker, msg, null);
-    }
-
-    @Override
-    public void trace(final Callable<?> msgSupplier) {
+    public void trace(final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.TRACE, null, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void trace(final Callable<?> msgSupplier, final Throwable t) {
+    public void trace(final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.TRACE, null, msgSupplier, t);
     }
 
     @Override
-    public void trace(final Marker marker, final Callable<?> msgSupplier) {
+    public void trace(final Marker marker, final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.TRACE, marker, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void trace(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+    public void trace(final Marker marker, final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.TRACE, marker, message, paramSuppliers);
     }
 
     @Override
-    public void trace(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+    public void trace(final Marker marker, final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.TRACE, marker, msgSupplier, t);
     }
 
     @Override
-    public void trace(final String message, final Callable<?>... paramSuppliers) {
+    public void trace(final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.TRACE, null, message, paramSuppliers);
     }
 
     @Override
+    public void trace(final Marker marker, final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.TRACE, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void trace(final Marker marker, final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.TRACE, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void trace(final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.TRACE, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void trace(final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.TRACE, null, msgSupplier, t);
+    }
+
+    @Override
+    public void warn(final Marker marker, final Message msg) {
+        logIfEnabled(FQCN, Level.WARN, marker, msg, null);
+    }
+
+    @Override
     public void warn(final Marker marker, final Message msg, final Throwable t) {
         logIfEnabled(FQCN, Level.WARN, marker, msg, t);
     }
@@ -1079,11 +1214,6 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
         logIfEnabled(FQCN, Level.WARN, marker, message, null);
     }
 
-    /* -- FIXME: this comment looks lost
-     * Instead of one single method with Object... declared the following methods explicitly specify parameters because
-     * they perform dramatically better than having the JVM convert them to an array.
-     */
-
     @Override
     public void warn(final Marker marker, final Object message, final Throwable t) {
         logIfEnabled(FQCN, Level.WARN, marker, message, t);
@@ -1140,32 +1270,52 @@ public abstract class AbstractLogger implements ExtendedLambdaLogger, Serializab
     }
 
     @Override
-    public void warn(final Callable<?> msgSupplier) {
+    public void warn(final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.WARN, null, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void warn(final Callable<?> msgSupplier, final Throwable t) {
+    public void warn(final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.WARN, null, msgSupplier, t);
     }
 
     @Override
-    public void warn(final Marker marker, final Callable<?> msgSupplier) {
+    public void warn(final Marker marker, final Supplier<?> msgSupplier) {
         logIfEnabled(FQCN, Level.WARN, marker, msgSupplier, (Throwable) null);
     }
 
     @Override
-    public void warn(final Marker marker, final String message, final Callable<?>... paramSuppliers) {
+    public void warn(final Marker marker, final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.WARN, marker, message, paramSuppliers);
     }
 
     @Override
-    public void warn(final Marker marker, final Callable<?> msgSupplier, final Throwable t) {
+    public void warn(final Marker marker, final Supplier<?> msgSupplier, final Throwable t) {
         logIfEnabled(FQCN, Level.WARN, marker, msgSupplier, t);
     }
 
     @Override
-    public void warn(final String message, final Callable<?>... paramSuppliers) {
+    public void warn(final String message, final Supplier<?>... paramSuppliers) {
         logIfEnabled(FQCN, Level.WARN, null, message, paramSuppliers);
     }
+
+    @Override
+    public void warn(final Marker marker, final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.WARN, marker, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void warn(final Marker marker, final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.WARN, marker, msgSupplier, t);
+    }
+
+    @Override
+    public void warn(final MessageSupplier msgSupplier) {
+        logIfEnabled(FQCN, Level.WARN, null, msgSupplier, (Throwable) null);
+    }
+
+    @Override
+    public void warn(final MessageSupplier msgSupplier, final Throwable t) {
+        logIfEnabled(FQCN, Level.WARN, null, msgSupplier, t);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLambdaLogger.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLambdaLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLambdaLogger.java
deleted file mode 100644
index 5e61f62..0000000
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLambdaLogger.java
+++ /dev/null
@@ -1,56 +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.spi;
-
-import java.util.concurrent.Callable;
-
-import org.apache.logging.log4j.LambdaLogger;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-
-/**
- * Extends the {@code LambdaLogger} interface with methods that facilitate implementing or extending
- * {@code LambdaLogger}s. Users should not need to use this interface.
- */
-public interface ExtendedLambdaLogger extends ExtendedLogger, LambdaLogger {
-
-    /**
-     * Logs a message whose parameters are only to be constructed if the specified level is active.
-     * 
-     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
-     *            method when location information needs to be logged.
-     * @param level The logging Level to check.
-     * @param marker A Marker or null.
-     * @param message The message format.
-     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
-     */
-    void logIfEnabled(String fqcn, Level level, Marker marker, String message, Callable<?>... paramSuppliers);
-
-    /**
-     * Logs a message which is only to be constructed if the specified level is active.
-     * 
-     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
-     *            method when location information needs to be logged.
-     * @param level The logging Level to check.
-     * @param marker A Marker or null.
-     * @param msgSupplier A function, which when called, produces the desired log message.
-     * @param t the exception to log, including its stack trace.
-     */
-    void logIfEnabled(String fqcn, Level level, Marker marker, Callable<?> msgSupplier, Throwable t);
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger2.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger2.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger2.java
new file mode 100644
index 0000000..85ce529
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ExtendedLogger2.java
@@ -0,0 +1,68 @@
+/*
+ * 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 org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger2;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.util.MessageSupplier;
+import org.apache.logging.log4j.util.Supplier;
+
+/**
+ * Extends the {@code Logger2} interface with methods that facilitate implementing or extending
+ * {@code Logger2}s. Users should not need to use this interface.
+ */
+public interface ExtendedLogger2 extends ExtendedLogger, Logger2 {
+
+    /**
+     * Logs a message which is only to be constructed if the specified level is active.
+     * 
+     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
+     *            method when location information needs to be logged.
+     * @param level The logging Level to check.
+     * @param marker A Marker or null.
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void logIfEnabled(String fqcn, Level level, Marker marker, MessageSupplier msgSupplier, Throwable t);
+
+    /**
+     * Logs a message whose parameters are only to be constructed if the specified level is active.
+     * 
+     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
+     *            method when location information needs to be logged.
+     * @param level The logging Level to check.
+     * @param marker A Marker or null.
+     * @param message The message format.
+     * @param paramSuppliers An array of functions, which when called, produce the desired log message parameters.
+     */
+    void logIfEnabled(String fqcn, Level level, Marker marker, String message, Supplier<?>... paramSuppliers);
+
+    /**
+     * Logs a message which is only to be constructed if the specified level is active.
+     * 
+     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
+     *            method when location information needs to be logged.
+     * @param level The logging Level to check.
+     * @param marker A Marker or null.
+     * @param msgSupplier A function, which when called, produces the desired log message.
+     * @param t the exception to log, including its stack trace.
+     */
+    void logIfEnabled(String fqcn, Level level, Marker marker, Supplier<?> msgSupplier, Throwable t);
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
index 9ba491b..954886b 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/LambdaUtil.java
@@ -17,7 +17,8 @@
 
 package org.apache.logging.log4j.util;
 
-import java.util.concurrent.Callable;
+import org.apache.logging.log4j.message.Message;
+
 
 /**
  * Utility class for lambda support.
@@ -30,13 +31,13 @@ public class LambdaUtil {
      * @return an array containing the results of evaluating the lambda expressions (or {@code null} if the suppliers
      *         array was {@code null}
      */
-    public static Object[] callAll(Callable<?>... suppliers) {
+    public static Object[] getAll(Supplier<?>... suppliers) {
         if (suppliers == null) {
             return (Object[]) null;
         }
         final Object[] result = new Object[suppliers.length];
         for (int i = 0; i < result.length; i++) {
-            result[i] = call(suppliers[i]);
+            result[i] = get(suppliers[i]);
         }
         return result;
     }
@@ -47,16 +48,29 @@ public class LambdaUtil {
      * @return the results of evaluating the lambda expression (or {@code null} if the supplier
      *         was {@code null}
      */
-    public static Object call(Callable<?> supplier) {
+    public static Object get(Supplier<?> supplier) {
         if (supplier == null) {
             return null;
         }
         Object result = null;
         try {
-            result = supplier.call();
+            result = supplier.get();
         } catch (Exception ex) {
             result = ex;
         }
         return result;
     }
+
+    /**
+     * Returns the Message supplied by the specified function.
+     * @param supplier a lambda expression or {@code null}
+     * @return the Message resulting from evaluating the lambda expression (or {@code null} if the supplier was
+     * {@code null}
+     */
+    public static Message get(MessageSupplier supplier) {
+        if (supplier == null) {
+            return null;
+        }
+        return supplier.get();
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/util/MessageSupplier.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/MessageSupplier.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/MessageSupplier.java
new file mode 100644
index 0000000..1d268cf
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/MessageSupplier.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.util;
+
+import org.apache.logging.log4j.message.Message;
+
+/**
+ * Classes implementing this interface know how to supply {@link Message}s.
+ *
+ * <p>This is a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html">functional
+ * interface</a> intended to support lambda expressions in log4j 2.
+ *
+ * <p>Implementors are free to cache values or return a new or distinct value each time the supplier is invoked.
+ *
+ * @since log4j-2.4
+ */
+public interface MessageSupplier {
+
+    /**
+     * Gets a Message.
+     *
+     * @return a Message
+     */
+    Message get();
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/main/java/org/apache/logging/log4j/util/Supplier.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/Supplier.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/Supplier.java
new file mode 100644
index 0000000..51421f3
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/Supplier.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.util;
+
+/**
+ * Classes implementing this interface know how to supply a value.
+ *
+ * <p>This is a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html">functional
+ * interface</a> intended to support lambda expressions in log4j 2.
+ *
+ * <p>Implementors are free to cache values or return a new or distinct value each time the supplier is invoked.
+ *
+ * @param <T> the type of values returned by this supplier
+ *
+ * @since log4j-2.4
+ */
+public interface Supplier<T> {
+
+    /**
+     * Gets a value.
+     *
+     * @return a value
+     */
+    T get();
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
new file mode 100644
index 0000000..14dd36b
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
@@ -0,0 +1,190 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.message.SimpleMessage;
+import org.apache.logging.log4j.spi.AbstractLogger;
+import org.apache.logging.log4j.util.MessageSupplier;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests the AbstractLogger implementation of the Logger2 interface.
+ */
+public class Logger2Test {
+
+    private static class LogEvent {
+        @SuppressWarnings("unused")
+        final String fqcn;
+        @SuppressWarnings("unused")
+        final Level level;
+        final Marker marker;
+        final Message message;
+        final Throwable throwable;
+
+        public LogEvent(String fqcn, Level level, Marker marker, Message message, Throwable t) {
+            this.fqcn = fqcn;
+            this.level = level;
+            this.marker = marker;
+            this.message = message;
+            this.throwable = t;
+        }
+    }
+
+    class Logger2Impl extends AbstractLogger {
+        private static final long serialVersionUID = 1L;
+
+        boolean enabled = true;
+        final List<Logger2Test.LogEvent> list = new ArrayList<Logger2Test.LogEvent>();
+
+        @Override
+        public boolean isEnabled(Level level, Marker marker, Message message, Throwable t) {
+            return enabled;
+        }
+
+        @Override
+        public boolean isEnabled(Level level, Marker marker, Object message, Throwable t) {
+            return enabled;
+        }
+
+        @Override
+        public boolean isEnabled(Level level, Marker marker, String message, Throwable t) {
+            return enabled;
+        }
+
+        @Override
+        public boolean isEnabled(Level level, Marker marker, String message) {
+            return enabled;
+        }
+
+        @Override
+        public boolean isEnabled(Level level, Marker marker, String message, Object... params) {
+            return enabled;
+        }
+
+        @Override
+        public void logMessage(String fqcn, Level level, Marker marker, Message message, Throwable t) {
+            list.add(new LogEvent(fqcn, level, marker, message, t));
+        }
+
+        @Override
+        public Level getLevel() {
+            return null;
+        }
+
+        public AbstractLogger disable() {
+            enabled = false;
+            return this;
+        }
+
+        public AbstractLogger enable() {
+            enabled = true;
+            return this;
+        }
+    }
+
+    final Logger2Impl logger2 = new Logger2Impl();
+    final Message message = new SimpleMessage("HiMessage");
+    final Throwable throwable = new Error("I'm Bad");
+    final Marker marker = MarkerManager.getMarker("test");
+
+    class MyMessageSupplier implements MessageSupplier {
+        public int count = 0;
+
+        @Override
+        public Message get() {
+            count++;
+            return message;
+        }
+    };
+
+    final MyMessageSupplier messageSupplier = new MyMessageSupplier();
+
+    @Before
+    public void beforeEachTest() {
+        logger2.list.clear();
+        messageSupplier.count = 0;
+    }
+
+    @Test
+    public void testDebugMarkerMessageSupplier() {
+        logger2.disable().debug(marker, messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertEquals(0, messageSupplier.count);
+
+        logger2.enable().debug(marker, messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertEquals(1, messageSupplier.count);
+
+        LogEvent event = logger2.list.get(0);
+        assertSame(message, event.message);
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testDebugMessageSupplier() {
+        logger2.disable().debug(messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertEquals(0, messageSupplier.count);
+
+        logger2.enable().debug(messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertEquals(1, messageSupplier.count);
+
+        LogEvent event = logger2.list.get(0);
+        assertSame(message, event.message);
+    }
+
+    @Test
+    public void testDebugMarkerMessageSupplierThrowable() {
+        logger2.disable().debug(marker, messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertEquals(0, messageSupplier.count);
+
+        logger2.enable().debug(marker, messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertEquals(1, messageSupplier.count);
+
+        LogEvent event = logger2.list.get(0);
+        assertSame(marker, event.marker);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testDebugMessageSupplierThrowable() {
+        logger2.disable().debug(messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertEquals(0, messageSupplier.count);
+
+        logger2.enable().debug(messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertEquals(1, messageSupplier.count);
+
+        LogEvent event = logger2.list.get(0);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
index edfc50e..946c63c 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/LambdaUtilTest.java
@@ -17,8 +17,8 @@
 
 package org.apache.logging.log4j.util;
 
-import java.util.concurrent.Callable;
-
+import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.message.SimpleMessage;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -29,10 +29,21 @@ import static org.junit.Assert.*;
 public class LambdaUtilTest {
 
     @Test
-    public void testCallReturnsResultOfCallable() {
+    public void testGetSupplierResultOfSupplier() {
         final String expected = "result";
-        final Object actual = LambdaUtil.call(new Callable<String>() {
-            public String call() {
+        final Object actual = LambdaUtil.get(new Supplier<String>() {
+            public String get() {
+                return expected;
+            }
+        });
+        assertSame(expected, actual);
+    }
+
+    @Test
+    public void testGetMessageSupplierResultOfSupplier() {
+        final Message expected = new SimpleMessage("hi");
+        final Message actual = LambdaUtil.get(new MessageSupplier() {
+            public Message get() {
                 return expected;
             }
         });
@@ -40,55 +51,71 @@ public class LambdaUtilTest {
     }
 
     @Test
-    public void testCallReturnsNullIfCallableNull() {
-        final Object actual = LambdaUtil.call(null);
+    public void testGetSupplierReturnsNullIfSupplierNull() {
+        final Object actual = LambdaUtil.get((Supplier<?>) null);
+        assertNull(actual);
+    }
+
+    @Test
+    public void testGetMessageSupplierReturnsNullIfSupplierNull() {
+        final Object actual = LambdaUtil.get((MessageSupplier) null);
         assertNull(actual);
     }
 
     @Test
-    public void testCallReturnsExceptionIfCallableThrowsException() {
-        final Exception expected = new RuntimeException();
-        final Object actual = LambdaUtil.call(new Callable<String>() {
-            public String call() throws Exception{
+    public void testGetSupplierExceptionIfSupplierThrowsException() {
+        final RuntimeException expected = new RuntimeException();
+        final Object actual = LambdaUtil.get(new Supplier<String>() {
+            public String get() {
                 throw expected;
             }
         });
         assertSame(expected, actual);
     }
 
+    @Test
+    public void testGetMessageSupplierExceptionIfSupplierThrowsException() {
+        final RuntimeException expected = new RuntimeException();
+        final Object actual = LambdaUtil.get(new MessageSupplier() {
+            public Message get() {
+                throw expected;
+            }
+        });
+        assertSame(expected, actual);
+    }
 
     @Test
-    public void testCallAllReturnsResultOfCallables() {
+    public void testGetAllReturnsResultOfSuppliers() {
         final String expected1 = "result1";
-        Callable<String> function1 = new Callable<String>() {
-            public String call() {
+        Supplier<String> function1 = new Supplier<String>() {
+            public String get() {
                 return expected1;
             }
         };
         final String expected2 = "result2";
-        Callable<String> function2 = new Callable<String>() {
-            public String call() {
+        Supplier<String> function2 = new Supplier<String>() {
+            public String get() {
                 return expected2;
             }
         };
-        
-        Callable<?>[] functions = {function1, function2};
-        final Object[] actual = LambdaUtil.callAll(functions);
+
+        Supplier<?>[] functions = { function1, function2 };
+        final Object[] actual = LambdaUtil.getAll(functions);
         assertEquals(actual.length, functions.length);
         assertSame(expected1, actual[0]);
         assertSame(expected2, actual[1]);
     }
 
     @Test
-    public void testCallAllReturnsNullArrayIfCallablesArrayNull() {
-        final Object[] actual = LambdaUtil.callAll((Callable<?>[]) null);
+    public void testGetAllReturnsNullArrayIfSupplierArrayNull() {
+        final Object[] actual = LambdaUtil.getAll((Supplier<?>[]) null);
         assertNull(actual);
     }
 
     @Test
-    public void testCallAllReturnsNullElementsIfCallableArrayContainsNulls() {
-        final Callable<?>[] functions = new Callable[3];
-        final Object[] actual = LambdaUtil.callAll(functions);
+    public void testGetAllReturnsNullElementsIfSupplierArrayContainsNulls() {
+        final Supplier<?>[] functions = new Supplier[3];
+        final Object[] actual = LambdaUtil.getAll(functions);
         assertEquals(actual.length, functions.length);
         for (Object object : actual) {
             assertNull(object);
@@ -96,22 +123,22 @@ public class LambdaUtilTest {
     }
 
     @Test
-    public void testCallAllReturnsExceptionsIfCallablesThrowsException() {
-        final Exception expected1 = new RuntimeException();
-        Callable<String> function1 = new Callable<String>() {
-            public String call() throws Exception{
+    public void testGetAllReturnsExceptionsIfSuppliersThrowsException() {
+        final RuntimeException expected1 = new RuntimeException();
+        Supplier<String> function1 = new Supplier<String>() {
+            public String get() {
                 throw expected1;
             }
         };
-        final Exception expected2 = new RuntimeException();
-        Callable<String> function2 = new Callable<String>() {
-            public String call() throws Exception{
+        final RuntimeException expected2 = new RuntimeException();
+        Supplier<String> function2 = new Supplier<String>() {
+            public String get() {
                 throw expected2;
             }
         };
-        
-        Callable<?>[] functions = {function1, function2};
-        final Object[] actual = LambdaUtil.callAll(functions);
+
+        Supplier<?>[] functions = { function1, function2 };
+        final Object[] actual = LambdaUtil.getAll(functions);
         assertEquals(actual.length, functions.length);
         assertSame(expected1, actual[0]);
         assertSame(expected2, actual[1]);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12be6d86/src/site/xdoc/manual/api.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/api.xml b/src/site/xdoc/manual/api.xml
index 1783353..d7a8cd3 100644
--- a/src/site/xdoc/manual/api.xml
+++ b/src/site/xdoc/manual/api.xml
@@ -118,7 +118,7 @@ logger.printf(Level.INFO, "Logging in user %1$s with birthday %2$tm %2$te,%2$tY"
           <a name="LambdaSupport"/>
             <h4>Java 8 lambda support for lazy logging</h4>
             <p>
-              The <code>LambdaLogger</code> interface extends <code>Logger</code> to add support for lambda expressions.
+              The <code>Logger2</code> interface extends <code>Logger</code> to add support for lambda expressions.
               This logger allows client code to lazily log messages without explicitly checking if the requested log
               level is enabled. For example, previously you would write:
             </p>
@@ -129,12 +129,12 @@ if (logger.isTraceEnabled()) {
     logger.trace(&quot;Some long-running operation returned {}&quot;, expensiveOperation());
 }</pre>
             <p>
-              With Java 8 and the <code>LambdaLogger</code> interface, you can achieve the same effect by using a
+              With Java 8 and the <code>Logger2</code> interface, you can achieve the same effect by using a
               lambda expression. You no longer need to explicitly check the log level:
             </p>
             <pre class="prettyprint linenums">// Java-8 style optimization: no need to explicitly check the log level:
 // the lambda expression is not evaluated if the TRACE level is not enabled
-LambdaLogger logger = LogManager.getLambdaLogger();
+Logger2 logger = LogManager.getLogger2();
 logger.trace(&quot;Some long-running operation returned {}&quot;, () -> expensiveOperation());</pre>
 
           <h4>Logger Names</h4>


[09/11] logging-log4j2 git commit: LOG4J2-599 additional Logger2 tests

Posted by rp...@apache.org.
LOG4J2-599 additional Logger2 tests

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

Branch: refs/heads/master
Commit: b3ce3fcacd8504e72712eb8e3dc3bbf690828e58
Parents: 2d924ce
Author: rpopma <rp...@apache.org>
Authored: Mon Aug 10 00:53:27 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Aug 10 00:53:27 2015 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/Logger2Test.java   | 1091 +++++++++++++++++-
 1 file changed, 1079 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b3ce3fca/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
index 14dd36b..7509fc4 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/Logger2Test.java
@@ -24,6 +24,7 @@ import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.SimpleMessage;
 import org.apache.logging.log4j.spi.AbstractLogger;
 import org.apache.logging.log4j.util.MessageSupplier;
+import org.apache.logging.log4j.util.Supplier;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -37,7 +38,6 @@ public class Logger2Test {
     private static class LogEvent {
         @SuppressWarnings("unused")
         final String fqcn;
-        @SuppressWarnings("unused")
         final Level level;
         final Marker marker;
         final Message message;
@@ -105,39 +105,54 @@ public class Logger2Test {
     }
 
     final Logger2Impl logger2 = new Logger2Impl();
+    final String stringMessage = "Hi";
     final Message message = new SimpleMessage("HiMessage");
     final Throwable throwable = new Error("I'm Bad");
     final Marker marker = MarkerManager.getMarker("test");
 
     class MyMessageSupplier implements MessageSupplier {
-        public int count = 0;
+        public boolean invoked = false;
 
         @Override
         public Message get() {
-            count++;
+            invoked = true;
             return message;
         }
     };
 
     final MyMessageSupplier messageSupplier = new MyMessageSupplier();
 
+    class MySupplier implements Supplier<String> {
+        public boolean invoked = false;
+
+        @Override
+        public String get() {
+            invoked = true;
+            return stringMessage;
+        }
+    }
+
+    final MySupplier supplier = new MySupplier();
+
     @Before
     public void beforeEachTest() {
         logger2.list.clear();
-        messageSupplier.count = 0;
+        supplier.invoked = false;
+        messageSupplier.invoked = false;
     }
 
     @Test
     public void testDebugMarkerMessageSupplier() {
         logger2.disable().debug(marker, messageSupplier);
         assertTrue(logger2.list.isEmpty());
-        assertEquals(0, messageSupplier.count);
+        assertFalse(messageSupplier.invoked);
 
         logger2.enable().debug(marker, messageSupplier);
         assertEquals(1, logger2.list.size());
-        assertEquals(1, messageSupplier.count);
+        assertTrue(messageSupplier.invoked);
 
         LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
         assertSame(message, event.message);
         assertSame(marker, event.marker);
     }
@@ -146,13 +161,14 @@ public class Logger2Test {
     public void testDebugMessageSupplier() {
         logger2.disable().debug(messageSupplier);
         assertTrue(logger2.list.isEmpty());
-        assertEquals(0, messageSupplier.count);
+        assertFalse(messageSupplier.invoked);
 
         logger2.enable().debug(messageSupplier);
         assertEquals(1, logger2.list.size());
-        assertEquals(1, messageSupplier.count);
+        assertTrue(messageSupplier.invoked);
 
         LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
         assertSame(message, event.message);
     }
 
@@ -160,13 +176,14 @@ public class Logger2Test {
     public void testDebugMarkerMessageSupplierThrowable() {
         logger2.disable().debug(marker, messageSupplier, throwable);
         assertTrue(logger2.list.isEmpty());
-        assertEquals(0, messageSupplier.count);
+        assertFalse(messageSupplier.invoked);
 
         logger2.enable().debug(marker, messageSupplier, throwable);
         assertEquals(1, logger2.list.size());
-        assertEquals(1, messageSupplier.count);
+        assertTrue(messageSupplier.invoked);
 
         LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
         assertSame(marker, event.marker);
         assertSame(message, event.message);
         assertSame(throwable, event.throwable);
@@ -176,15 +193,1065 @@ public class Logger2Test {
     public void testDebugMessageSupplierThrowable() {
         logger2.disable().debug(messageSupplier, throwable);
         assertTrue(logger2.list.isEmpty());
-        assertEquals(0, messageSupplier.count);
+        assertFalse(messageSupplier.invoked);
 
         logger2.enable().debug(messageSupplier, throwable);
         assertEquals(1, logger2.list.size());
-        assertEquals(1, messageSupplier.count);
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testDebugMarkerSupplier() {
+        logger2.disable().debug(marker, supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().debug(marker, supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testDebugSupplier() {
+        logger2.disable().debug(supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().debug(supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testDebugMarkerSupplierThrowable() {
+        logger2.disable().debug(marker, supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().debug(marker, supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
+        assertSame(marker, event.marker);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testDebugSupplierThrowable() {
+        logger2.disable().debug(supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().debug(supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testDebugStringParamSupplier() {
+        logger2.disable().debug("abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().debug("abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testDebugMarkerStringParamSupplier() {
+        logger2.disable().debug(marker, "abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().debug(marker, "abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.DEBUG, event.level);
+        assertSame(marker, event.marker);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testErrorMarkerMessageSupplier() {
+        logger2.disable().error(marker, messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().error(marker, messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(message, event.message);
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testErrorMessageSupplier() {
+        logger2.disable().error(messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().error(messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(message, event.message);
+    }
+
+    @Test
+    public void testErrorMarkerMessageSupplierThrowable() {
+        logger2.disable().error(marker, messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().error(marker, messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(marker, event.marker);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testErrorMessageSupplierThrowable() {
+        logger2.disable().error(messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().error(messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testErrorMarkerSupplier() {
+        logger2.disable().error(marker, supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().error(marker, supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testErrorSupplier() {
+        logger2.disable().error(supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().error(supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testErrorMarkerSupplierThrowable() {
+        logger2.disable().error(marker, supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().error(marker, supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(marker, event.marker);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testErrorSupplierThrowable() {
+        logger2.disable().error(supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().error(supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testErrorStringParamSupplier() {
+        logger2.disable().error("abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().error("abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testErrorMarkerStringParamSupplier() {
+        logger2.disable().error(marker, "abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().error(marker, "abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.ERROR, event.level);
+        assertSame(marker, event.marker);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testFatalMarkerMessageSupplier() {
+        logger2.disable().fatal(marker, messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().fatal(marker, messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertSame(message, event.message);
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testFatalMessageSupplier() {
+        logger2.disable().fatal(messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().fatal(messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertSame(message, event.message);
+    }
+
+    @Test
+    public void testFatalMarkerMessageSupplierThrowable() {
+        logger2.disable().fatal(marker, messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().fatal(marker, messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertSame(marker, event.marker);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testFatalMessageSupplierThrowable() {
+        logger2.disable().fatal(messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().fatal(messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
 
         LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
         assertSame(message, event.message);
         assertSame(throwable, event.throwable);
     }
 
+    @Test
+    public void testFatalMarkerSupplier() {
+        logger2.disable().fatal(marker, supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().fatal(marker, supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testFatalSupplier() {
+        logger2.disable().fatal(supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().fatal(supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testFatalMarkerSupplierThrowable() {
+        logger2.disable().fatal(marker, supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().fatal(marker, supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertSame(marker, event.marker);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testFatalSupplierThrowable() {
+        logger2.disable().fatal(supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().fatal(supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testFatalStringParamSupplier() {
+        logger2.disable().fatal("abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().fatal("abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testFatalMarkerStringParamSupplier() {
+        logger2.disable().fatal(marker, "abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().fatal(marker, "abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.FATAL, event.level);
+        assertSame(marker, event.marker);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testInfoMarkerMessageSupplier() {
+        logger2.disable().info(marker, messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().info(marker, messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(message, event.message);
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testInfoMessageSupplier() {
+        logger2.disable().info(messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().info(messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(message, event.message);
+    }
+
+    @Test
+    public void testInfoMarkerMessageSupplierThrowable() {
+        logger2.disable().info(marker, messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().info(marker, messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(marker, event.marker);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testInfoMessageSupplierThrowable() {
+        logger2.disable().info(messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().info(messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testInfoMarkerSupplier() {
+        logger2.disable().info(marker, supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().info(marker, supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testInfoSupplier() {
+        logger2.disable().info(supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().info(supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testInfoMarkerSupplierThrowable() {
+        logger2.disable().info(marker, supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().info(marker, supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(marker, event.marker);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testInfoSupplierThrowable() {
+        logger2.disable().info(supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().info(supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testInfoStringParamSupplier() {
+        logger2.disable().info("abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().info("abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testInfoMarkerStringParamSupplier() {
+        logger2.disable().info(marker, "abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().info(marker, "abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.INFO, event.level);
+        assertSame(marker, event.marker);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testTraceMarkerMessageSupplier() {
+        logger2.disable().trace(marker, messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().trace(marker, messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(message, event.message);
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testTraceMessageSupplier() {
+        logger2.disable().trace(messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().trace(messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(message, event.message);
+    }
+
+    @Test
+    public void testTraceMarkerMessageSupplierThrowable() {
+        logger2.disable().trace(marker, messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().trace(marker, messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(marker, event.marker);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testTraceMessageSupplierThrowable() {
+        logger2.disable().trace(messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().trace(messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testTraceMarkerSupplier() {
+        logger2.disable().trace(marker, supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().trace(marker, supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testTraceSupplier() {
+        logger2.disable().trace(supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().trace(supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testTraceMarkerSupplierThrowable() {
+        logger2.disable().trace(marker, supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().trace(marker, supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(marker, event.marker);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testTraceSupplierThrowable() {
+        logger2.disable().trace(supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().trace(supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testTraceStringParamSupplier() {
+        logger2.disable().trace("abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().trace("abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testTraceMarkerStringParamSupplier() {
+        logger2.disable().trace(marker, "abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().trace(marker, "abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.TRACE, event.level);
+        assertSame(marker, event.marker);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testWarnMarkerMessageSupplier() {
+        logger2.disable().warn(marker, messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().warn(marker, messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(message, event.message);
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testWarnMessageSupplier() {
+        logger2.disable().warn(messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().warn(messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(message, event.message);
+    }
+
+    @Test
+    public void testWarnMarkerMessageSupplierThrowable() {
+        logger2.disable().warn(marker, messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().warn(marker, messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(marker, event.marker);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testWarnMessageSupplierThrowable() {
+        logger2.disable().warn(messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().warn(messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testWarnMarkerSupplier() {
+        logger2.disable().warn(marker, supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().warn(marker, supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testWarnSupplier() {
+        logger2.disable().warn(supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().warn(supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testWarnMarkerSupplierThrowable() {
+        logger2.disable().warn(marker, supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().warn(marker, supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(marker, event.marker);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testWarnSupplierThrowable() {
+        logger2.disable().warn(supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().warn(supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testWarnStringParamSupplier() {
+        logger2.disable().warn("abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().warn("abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testWarnMarkerStringParamSupplier() {
+        logger2.disable().warn(marker, "abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().warn(marker, "abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(marker, event.marker);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testLogMarkerMessageSupplier() {
+        logger2.disable().log(Level.WARN, marker, messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().log(Level.WARN, marker, messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(message, event.message);
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testLogMessageSupplier() {
+        logger2.disable().log(Level.WARN, messageSupplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().log(Level.WARN, messageSupplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(message, event.message);
+    }
+
+    @Test
+    public void testLogMarkerMessageSupplierThrowable() {
+        logger2.disable().log(Level.WARN, marker, messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().log(Level.WARN, marker, messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(marker, event.marker);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testLogMessageSupplierThrowable() {
+        logger2.disable().log(Level.WARN, messageSupplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(messageSupplier.invoked);
+
+        logger2.enable().log(Level.WARN, messageSupplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(messageSupplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(message, event.message);
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testLogMarkerSupplier() {
+        logger2.disable().log(Level.WARN, marker, supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().log(Level.WARN, marker, supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(marker, event.marker);
+    }
+
+    @Test
+    public void testLogSupplier() {
+        logger2.disable().log(Level.WARN, supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().log(Level.WARN, supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testLogMarkerSupplierThrowable() {
+        logger2.disable().log(Level.WARN, marker, supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().log(Level.WARN, marker, supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(marker, event.marker);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testLogSupplierThrowable() {
+        logger2.disable().log(Level.WARN, supplier, throwable);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().log(Level.WARN, supplier, throwable);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(stringMessage, event.message.getFormattedMessage());
+        assertSame(throwable, event.throwable);
+    }
+
+    @Test
+    public void testLogStringParamSupplier() {
+        logger2.disable().log(Level.WARN, "abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().log(Level.WARN, "abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
+    @Test
+    public void testLogMarkerStringParamSupplier() {
+        logger2.disable().log(Level.WARN, marker, "abc {}", supplier);
+        assertTrue(logger2.list.isEmpty());
+        assertFalse(supplier.invoked);
+
+        logger2.enable().log(Level.WARN, marker, "abc {}", supplier);
+        assertEquals(1, logger2.list.size());
+        assertTrue(supplier.invoked);
+
+        LogEvent event = logger2.list.get(0);
+        assertEquals(Level.WARN, event.level);
+        assertSame(marker, event.marker);
+        assertEquals("abc Hi", event.message.getFormattedMessage());
+    }
+
 }