You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2017/02/25 05:46:39 UTC

logging-log4j2 git commit: [LOG4J2-1823]: Remove deprecation on MessageSupplier lambda functions in Logger API

Repository: logging-log4j2
Updated Branches:
  refs/heads/master a6c3aed0c -> 180e7e134


[LOG4J2-1823]: Remove deprecation on MessageSupplier lambda functions in Logger API


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

Branch: refs/heads/master
Commit: 180e7e134aa165d5a43ae6ab04501021907b3bb4
Parents: a6c3aed
Author: Matt Sicker <bo...@gmail.com>
Authored: Fri Feb 24 23:47:09 2017 -0600
Committer: Matt Sicker <bo...@gmail.com>
Committed: Fri Feb 24 23:47:09 2017 -0600

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/Logger.java   | 62 ++------------------
 .../logging/log4j/spi/ExtendedLogger.java       |  2 -
 .../logging/log4j/util/MessageSupplier.java     |  7 ++-
 .../org/apache/logging/log4j/util/Supplier.java |  2 +
 src/changes/changes.xml                         |  3 +
 5 files changed, 16 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/180e7e13/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 d38af94..995c6df 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
@@ -67,6 +67,12 @@ import org.apache.logging.log4j.util.Supplier;
  * // the lambda expression is not evaluated if the TRACE level is not enabled
  * logger.trace(&quot;Some long-running operation returned {}&quot;, () -&gt; expensiveOperation());
  * </pre>
+ *
+ * <p>
+ * Note that although {@link MessageSupplier} is provided, using {@link Supplier Supplier<Message>} works just the
+ * same. MessageSupplier was deprecated in 2.6 and un-deprecated in 2.8.1. Anonymous class usage of these APIs
+ * should prefer using Supplier instead.
+ * </p>
  */
 public interface Logger {
 
@@ -113,9 +119,7 @@ public interface Logger {
      * @param marker the marker data specific to this log statement
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void debug(Marker marker, MessageSupplier msgSupplier);
 
     /**
@@ -127,9 +131,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t A Throwable or null.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void debug(Marker marker, MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -251,9 +253,7 @@ public interface Logger {
      *
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void debug(MessageSupplier msgSupplier);
 
     /**
@@ -264,9 +264,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t the exception to log, including its stack trace.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void debug(MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -675,9 +673,7 @@ public interface Logger {
      * @param marker the marker data specific to this log statement
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void error(Marker marker, MessageSupplier msgSupplier);
 
     /**
@@ -689,9 +685,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t A Throwable or null.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void error(Marker marker, MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -813,9 +807,7 @@ public interface Logger {
      *
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void error(MessageSupplier msgSupplier);
 
     /**
@@ -826,9 +818,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t the exception to log, including its stack trace.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void error(MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -1231,9 +1221,7 @@ public interface Logger {
      * @param marker the marker data specific to this log statement
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void fatal(Marker marker, MessageSupplier msgSupplier);
 
     /**
@@ -1245,9 +1233,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t A Throwable or null.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void fatal(Marker marker, MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -1369,9 +1355,7 @@ public interface Logger {
      *
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void fatal(MessageSupplier msgSupplier);
 
     /**
@@ -1382,9 +1366,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t the exception to log, including its stack trace.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void fatal(MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -1792,9 +1774,7 @@ public interface Logger {
      * @param marker the marker data specific to this log statement
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void info(Marker marker, MessageSupplier msgSupplier);
 
     /**
@@ -1806,9 +1786,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t A Throwable or null.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void info(Marker marker, MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -1930,9 +1908,7 @@ public interface Logger {
      *
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void info(MessageSupplier msgSupplier);
 
     /**
@@ -1943,9 +1919,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t the exception to log, including its stack trace.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void info(MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -2445,9 +2419,7 @@ public interface Logger {
      * @param marker the marker data specific to this log statement
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void log(Level level, Marker marker, MessageSupplier msgSupplier);
 
     /**
@@ -2460,9 +2432,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t A Throwable or null.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void log(Level level, Marker marker, MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -2595,9 +2565,7 @@ public interface Logger {
      * @param level the logging level
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void log(Level level, MessageSupplier msgSupplier);
 
     /**
@@ -2609,9 +2577,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t the exception to log, including its stack log.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void log(Level level, MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -3067,9 +3033,7 @@ public interface Logger {
      * @param marker the marker data specific to this log statement
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void trace(Marker marker, MessageSupplier msgSupplier);
 
     /**
@@ -3081,9 +3045,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t A Throwable or null.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void trace(Marker marker, MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -3208,9 +3170,7 @@ public interface Logger {
      *
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void trace(MessageSupplier msgSupplier);
 
     /**
@@ -3221,9 +3181,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t the exception to log, including its stack trace.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void trace(MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -3790,9 +3748,7 @@ public interface Logger {
      * @param marker the marker data specific to this log statement
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void warn(Marker marker, MessageSupplier msgSupplier);
 
     /**
@@ -3804,9 +3760,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t A Throwable or null.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void warn(Marker marker, MessageSupplier msgSupplier, Throwable t);
 
     /**
@@ -3928,9 +3882,7 @@ public interface Logger {
      *
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void warn(MessageSupplier msgSupplier);
 
     /**
@@ -3941,9 +3893,7 @@ public interface Logger {
      * @param msgSupplier A function, which when called, produces the desired log message.
      * @param t the exception to log, including its stack warn.
      * @since 2.4
-     * @deprecated Deprecated in 2.6, use the {@link Supplier} version of this API instead.
      */
-    @Deprecated
     void warn(MessageSupplier msgSupplier, Throwable t);
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/180e7e13/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 2e90a03..8e943e7 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
@@ -520,9 +520,7 @@ public interface ExtendedLogger extends Logger {
      * @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.
-     * @deprecated Deprecated in 2.6; use {@link #logIfEnabled(String, Level, Marker, Supplier, Throwable)}
      */
-    @Deprecated
     void logIfEnabled(String fqcn, Level level, Marker marker, MessageSupplier msgSupplier, Throwable t);
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/180e7e13/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
index e1d3329..f38f75c 100644
--- 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
@@ -27,10 +27,13 @@ import org.apache.logging.log4j.message.Message;
  *
  * <p>Implementors are free to cache values or return a new or distinct value each time the supplier is invoked.
  *
+ * <p><strong>DEPRECATED:</strong> this class should not normally be used outside a Java 8+ lambda syntax. Instead,
+ * {@link Supplier Supplier<Message>} should be used as an anonymous class. Both this and {@link Supplier} will be
+ * removed in 3.0.
+ * </p>
+ *
  * @since 2.4
- * @deprecated Since 2.6, use {@link Supplier} instead as {@code Supplier<Message>}. 
  */
-@Deprecated
 public interface MessageSupplier {
 
     /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/180e7e13/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
index eb947dc..22d0a7b 100644
--- 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
@@ -26,6 +26,8 @@ package org.apache.logging.log4j.util;
  *
  * <p>Implementors are free to cache values or return a new or distinct value each time the supplier is invoked.
  *
+ * <p><strong>DEPRECATED:</strong> this class will be removed in 3.0 to be replaced with the Java 8 interface.</p>
+ *
  * @param <T> the type of values returned by this supplier
  *
  * @since 2.4

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/180e7e13/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2ae50a1..8c6c6a6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,6 +64,9 @@
       <action issue="LOG4J2-1818" dev="ggregory" type="fix" due-to="xkr47">
         Fix rollover to work when filePattern contains no directory components.
       </action>
+      <action issue="LOG4J2-1823" dev="mattsicker" type="add">
+        Remove deprecation on MessageSupplier lambda functions in Logger API.
+      </action>
       <action issue="LOG4J2-1807" dev="ggregory" type="add">
         [core] Add and implement LogEvent.toImmutable().
       </action>