logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1460661 - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/spi/ api/src/test/java/org/apache/logging/log4j/ src/changes/
Date Mon, 25 Mar 2013 13:51:33 GMT
Author: ggregory
Date: Mon Mar 25 13:51:32 2013
New Revision: 1460661

URL: http://svn.apache.org/r1460661
Log:
[LOG4J2-179] Add Logger interface APIs to log at given levels. (I had to @Ignore SocketReconnectTest
locally to get the whole system to run 'mvn clean test'.)

Modified:
    logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java
    logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
    logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java?rev=1460661&r1=1460660&r2=1460661&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java (original)
+++ logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java Mon
Mar 25 13:51:32 2013
@@ -156,8 +156,8 @@ public interface Logger {
    * @param t       the exception to log, including its stack trace.
    */
   void debug(String message, Throwable t);
-
-   /**
+  
+  /**
    * Logs entry to a method.
    */
   void entry();
@@ -278,7 +278,7 @@ public interface Logger {
    */
   void error(String message);
 
-  /**
+   /**
    * Logs a message with parameters at the {@link Level#ERROR ERROR} level.
    *
    * @param message the message to log; the format depends on the message factory.
@@ -465,6 +465,7 @@ public interface Logger {
    * @param msg    the message string to be logged
    */
   void info(Marker marker, Message msg);
+
   /**
    * Logs a message with the specific Marker at the {@link Level#INFO INFO} level.
    *
@@ -556,7 +557,7 @@ public interface Logger {
    */
   void info(Object message, Throwable t);
 
- /**
+  /**
    * Logs a message object with the {@link Level#INFO INFO} level.
    *
    * @param message the message object to log.
@@ -593,7 +594,6 @@ public interface Logger {
    *         DEBUG, {@code false} otherwise.
    */
   boolean isDebugEnabled();
-
   /**
    * Checks whether this Logger is enabled for the {@link Level#DEBUG DEBUG} Level.
    *
@@ -681,7 +681,7 @@ public interface Logger {
    */
   boolean isTraceEnabled(Marker marker);
 
-  /**
+ /**
    * Checks whether this Logger is enabled for the {@link Level#WARN WARN} Level.
    *
    * @return boolean - {@code true} if this Logger is enabled for level
@@ -699,6 +699,139 @@ public interface Logger {
   boolean isWarnEnabled(Marker marker);
 
   /**
+   * Logs a message with the specific Marker at the given level.
+   *
+   * @param level the logging level
+   * @param marker the marker data specific to this log statement
+   * @param msg the message string to be logged
+   */
+  void log(Level level, Marker marker, Message msg);
+
+  /**
+   * Logs a message with the specific Marker at the given level.
+   *
+   * @param level the logging level
+   * @param marker the marker data specific to this log statement
+   * @param msg the message string to be logged
+   * @param t A Throwable or null.
+   */
+  void log(Level level, Marker marker, Message msg, Throwable t);
+
+  /**
+   * Logs a message object with the given level.
+   *
+   * @param level the logging level
+   * @param marker the marker data specific to this log statement
+   * @param message the message object to log.
+   */
+  void log(Level level, Marker marker, Object message);
+
+  /**
+   * Logs a message at the given level including the
+   * stack trace 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 message the message to log.
+   * @param t the exception to log, including its stack trace.
+   */
+  void log(Level level, Marker marker, Object message, Throwable t);
+
+  /**
+   * Logs a message object with the given level.
+   *
+   * @param level the logging level
+   * @param marker the marker data specific to this log statement
+   * @param message the message object to log.
+   */
+  void log(Level level, Marker marker, String message);
+
+  /**
+   * Logs a message with parameters at the given 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 params parameters to the message.
+   * @see #getMessageFactory()
+   */
+  void log(Level level, Marker marker, String message, Object... params);
+
+  /**
+   * Logs a message at the given level including the
+   * stack trace 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 message the message to log.
+   * @param t the exception to log, including its stack trace.
+   */
+  void log(Level level, Marker marker, String message, Throwable t);
+
+  /**
+   * Logs a message with the specific Marker at the given level.
+   *
+   * @param level the logging level
+   * @param msg the message string to be logged
+   */
+  void log(Level level, Message msg);
+
+  /**
+   * Logs a message with the specific Marker at the given level.
+   *
+   * @param level the logging level
+   * @param msg the message string to be logged
+   * @param t A Throwable or null.
+   */
+  void log(Level level, Message msg, Throwable t);
+
+  /**
+   * Logs a message object with the given level.
+   *
+   * @param level the logging level
+   * @param message the message object to log.
+   */
+  void log(Level level, Object message);
+
+  /**
+   * Logs a message at the given level including the
+   * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+   *
+   * @param level the logging level
+   * @param message the message to log.
+   * @param t the exception to log, including its stack trace.
+   */
+  void log(Level level, Object message, Throwable t);
+
+  /**
+   * Logs a message object with the given level.
+   *
+   * @param level the logging level
+   * @param message the message object to log.
+   */
+  void log(Level level, String message);
+
+  /**
+   * Logs a message with parameters at the given level.
+   *
+   * @param level the logging level
+   * @param message the message to log; the format depends on the message factory.
+   * @param params parameters to the message.
+   * @see #getMessageFactory()
+   */
+  void log(Level level, String message, Object... params);
+
+  /**
+   * Logs a message at the given level including the
+   * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+   *
+   * @param level the logging level
+   * @param message the message to log.
+   * @param t the exception to log, including its stack trace.
+   */
+  void log(Level level, String message, Throwable t);
+
+  /**
    * Logs an exception or error to be thrown. This may be coded as <br />
    *    throw logger.throwing(debug, myException);
    * @param <T> the Throwable type.

Modified: logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java?rev=1460661&r1=1460660&r2=1460661&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
(original)
+++ logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
Mon Mar 25 13:51:32 2013
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.status.S
  *
  */
 public abstract class AbstractLogger implements Logger {
+
     /**
      * Marker for flow tracing.
      */
@@ -45,6 +46,7 @@ public abstract class AbstractLogger imp
      */
     public static final Marker EXIT_MARKER = MarkerManager.getMarker("EXIT", FLOW_MARKER);
 
+
     /**
      * Marker for exception tracing.
      */
@@ -204,7 +206,6 @@ public abstract class AbstractLogger imp
         }
     }
 
-
     /**
      * Logs a message at the {@link Level#DEBUG DEBUG} level including the
      * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
@@ -383,6 +384,7 @@ public abstract class AbstractLogger imp
         return messageFactory.newMessage(sb.toString());
     }
 
+
     /**
      * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level.
      *
@@ -496,6 +498,7 @@ public abstract class AbstractLogger imp
             log(null, FQCN, Level.ERROR, msg, t);
         }
     }
+
     /**
      * Logs a message object with the {@link Level#ERROR ERROR} level.
      *
@@ -670,7 +673,6 @@ public abstract class AbstractLogger imp
             log(marker, FQCN, Level.FATAL, messageFactory.newMessage(message), t);
         }
     }
-
     /**
      * Logs a message with the specific Marker at the FATAL level.
      *
@@ -729,7 +731,6 @@ public abstract class AbstractLogger imp
         }
     }
 
-
     /**
      * Logs a message with parameters at the {@link Level#FATAL FATAL} level.
      *
@@ -897,6 +898,7 @@ public abstract class AbstractLogger imp
         }
     }
 
+
     /**
      * Logs a message at the {@link Level#INFO INFO} level including the
      * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
@@ -968,7 +970,6 @@ public abstract class AbstractLogger imp
         return isEnabled(Level.DEBUG, marker, (Object) null, null);
     }
 
-
     /**
      * Checks whether this Logger is enabled for the the given Level.
      * <p>
@@ -1113,6 +1114,7 @@ public abstract class AbstractLogger imp
         return isEnabled(Level.TRACE, marker, (Object) null, null);
     }
 
+
     /**
      * Checks whether this Logger is enabled for the WARN Level.
      *
@@ -1123,7 +1125,6 @@ public abstract class AbstractLogger imp
         return isEnabled(Level.WARN, null, (Object) null, null);
     }
 
-
     /**
      * Checks whether this Logger is enabled for the WARN Level.
      *
@@ -1136,6 +1137,196 @@ public abstract class AbstractLogger imp
     }
 
     /**
+     * Logs a message with the specific Marker at the given level.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement
+     * @param msg the message string to be logged
+     */
+    public void log(Level level, final Marker marker, final Message msg) {
+        if (isEnabled(level, marker, msg, null)) {
+            log(marker, FQCN, level, msg, null);
+        }
+    }
+
+    /**
+     * Logs a message with the specific Marker at the given level.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement.
+     * @param msg the message string to be logged
+     * @param t A Throwable or null.
+     */
+    public void log(Level level, final Marker marker, final Message msg, final Throwable
t) {
+        if (isEnabled(level, marker, msg, t)) {
+            log(marker, FQCN, level, msg, t);
+        }
+    }
+
+    /**
+     * Logs a message object with the given level.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement.
+     * @param message the message object to log.
+     */
+    public void log(Level level, final Marker marker, final Object message) {
+        if (isEnabled(level, marker, message, null)) {
+            log(marker, FQCN, level, messageFactory.newMessage(message), null);
+        }
+    }
+
+    /**
+     * Logs a message at the given level including the
+     * stack trace 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 message the message to log.
+     * @param t the exception to log, including its stack trace.
+     */
+    public void log(Level level, final Marker marker, final Object message, final Throwable
t) {
+        if (isEnabled(level, marker, message, t)) {
+            log(marker, FQCN, level, messageFactory.newMessage(message), t);
+        }
+    }
+
+    /**
+     * Logs a message object with the given level.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement.
+     * @param message the message object to log.
+     */
+    public void log(Level level, final Marker marker, final String message) {
+        if (isEnabled(level, marker, message)) {
+            log(marker, FQCN, level, messageFactory.newMessage(message), null);
+        }
+    }
+
+    /**
+     * Logs a message with parameters at the given level.
+     *
+     * @param level the logging level
+     * @param marker the marker data specific to this log statement.
+     * @param message the message to log.
+     * @param params parameters to the message.
+     */
+    public void log(Level level, final Marker marker, final String message, final Object...
params) {
+        if (isEnabled(level, marker, message, params)) {
+            final Message msg = messageFactory.newMessage(message, params);
+            log(marker, FQCN, level, msg, msg.getThrowable());
+        }
+    }
+
+    /**
+     * Logs a message at the given level including the
+     * stack trace 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 message the message to log.
+     * @param t the exception to log, including its stack trace.
+     */
+    public void log(Level level, final Marker marker, final String message, final Throwable
t) {
+        if (isEnabled(level, marker, message, t)) {
+            log(marker, FQCN, level, messageFactory.newMessage(message), t);
+        }
+    }
+
+    /**
+     * Logs a message with the specific Marker at the given level.
+     *
+     * @param level the logging level
+     * @param msg the message string to be logged
+     */
+    public void log(Level level, final Message msg) {
+        if (isEnabled(level, null, msg, null)) {
+            log(null, FQCN, level, msg, null);
+        }
+    }
+
+    /**
+     * Logs a message with the specific Marker at the given level.
+     *
+     * @param level the logging level
+     * @param msg the message string to be logged
+     * @param t A Throwable or null.
+     */
+    public void log(Level level, final Message msg, final Throwable t) {
+        if (isEnabled(level, null, msg, t)) {
+            log(null, FQCN, level, msg, t);
+        }
+    }
+
+    /**
+     * Logs a message object with the given level.
+     *
+     * @param level the logging level
+     * @param message the message object to log.
+     */
+    public void log(Level level, final Object message) {
+        if (isEnabled(level, null, message, null)) {
+            log(null, FQCN, level, messageFactory.newMessage(message), null);
+        }
+    }
+
+    /**
+     * Logs a message at the given level including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param level the logging level
+     * @param message the message to log.
+     * @param t the exception to log, including its stack trace.
+     */
+    public void log(Level level, final Object message, final Throwable t) {
+        if (isEnabled(level, null, message, t)) {
+            log(null, FQCN, level, messageFactory.newMessage(message), t);
+        }
+    }
+
+    /**
+     * Logs a message object with the given level.
+     *
+     * @param level the logging level
+     * @param message the message object to log.
+     */
+    public void log(Level level, final String message) {
+        if (isEnabled(level, null, message)) {
+            log(null, FQCN, level, messageFactory.newMessage(message), null);
+        }
+    }
+
+    /**
+     * Logs a message with parameters at the given level.
+     *
+     * @param level the logging level
+     * @param message the message to log.
+     * @param params parameters to the message.
+     */
+    public void log(Level level, final String message, final Object... params) {
+        if (isEnabled(level, null, message, params)) {
+            final Message msg = messageFactory.newMessage(message, params);
+            log(null, FQCN, level, msg, msg.getThrowable());
+        }
+    }
+
+
+    /**
+     * Logs a message at the given level including the
+     * stack trace of the {@link Throwable} <code>t</code> passed as parameter.
+     *
+     * @param level the logging level
+     * @param message the message to log.
+     * @param t the exception to log, including its stack trace.
+     */
+    public void log(Level level, final String message, final Throwable t) {
+        if (isEnabled(level, null, message, t)) {
+            log(null, FQCN, level, messageFactory.newMessage(message), t);
+        }
+    }
+
+    /**
      * Logs a message with location information.
      *
      * @param marker The Marker

Modified: logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java?rev=1460661&r1=1460660&r2=1460661&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java
(original)
+++ logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java
Mon Mar 25 13:51:32 2013
@@ -361,6 +361,258 @@ public class AbstractLoggerTest extends 
     }
 
     @Test
+    public void testLogDebug() {
+        currentLevel = Level.DEBUG;
+
+        currentEvent = events[0];
+        log(Level.DEBUG, "Hello");
+        log(Level.DEBUG, null, "Hello");
+        currentEvent = events[1];
+        log(Level.DEBUG, MarkerManager.getMarker("TEST"), "Hello");
+        currentEvent = events[2];
+        log(Level.DEBUG, "Hello", t);
+        log(Level.DEBUG, null, "Hello", t);
+        currentEvent = events[3];
+        log(Level.DEBUG, MarkerManager.getMarker("TEST"), "Hello", t);
+        currentEvent = events[4];
+        log(Level.DEBUG, obj);
+        currentEvent = events[5];
+        log(Level.DEBUG, MarkerManager.getMarker("TEST"), obj);
+        currentEvent = events[6];
+        log(Level.DEBUG, obj, t);
+        log(Level.DEBUG, null, obj, t);
+        currentEvent = events[7];
+        log(Level.DEBUG, MarkerManager.getMarker("TEST"), obj, t);
+        currentEvent = events[8];
+        log(Level.DEBUG, pattern, p1, p2);
+        currentEvent = events[9];
+        log(Level.DEBUG, MarkerManager.getMarker("TEST"), pattern, p1, p2);
+        currentEvent = events[10];
+        log(Level.DEBUG, simple);
+        log(Level.DEBUG, null, simple);
+        log(Level.DEBUG, null, simple, null);
+        currentEvent = events[11];
+        log(Level.DEBUG, simple, t);
+        log(Level.DEBUG, null, simple, t);
+        currentEvent = events[12];
+        log(Level.DEBUG, MarkerManager.getMarker("TEST"), simple, null);
+        currentEvent = events[13];
+        log(Level.DEBUG, MarkerManager.getMarker("TEST"), simple, t);
+        currentEvent = events[14];
+        log(Level.DEBUG, MarkerManager.getMarker("TEST"), simple);
+    }
+
+    @Test
+    public void testLogError() {
+        currentLevel = Level.ERROR;
+
+        currentEvent = events[0];
+        log(Level.ERROR, "Hello");
+        log(Level.ERROR, null, "Hello");
+        currentEvent = events[1];
+        log(Level.ERROR, MarkerManager.getMarker("TEST"), "Hello");
+        currentEvent = events[2];
+        log(Level.ERROR, "Hello", t);
+        log(Level.ERROR, null, "Hello", t);
+        currentEvent = events[3];
+        log(Level.ERROR, MarkerManager.getMarker("TEST"), "Hello", t);
+        currentEvent = events[4];
+        log(Level.ERROR, obj);
+        currentEvent = events[5];
+        log(Level.ERROR, MarkerManager.getMarker("TEST"), obj);
+        currentEvent = events[6];
+        log(Level.ERROR, obj, t);
+        log(Level.ERROR, null, obj, t);
+        currentEvent = events[7];
+        log(Level.ERROR, MarkerManager.getMarker("TEST"), obj, t);
+        currentEvent = events[8];
+        log(Level.ERROR, pattern, p1, p2);
+        currentEvent = events[9];
+        log(Level.ERROR, MarkerManager.getMarker("TEST"), pattern, p1, p2);
+        currentEvent = events[10];
+        log(Level.ERROR, simple);
+        log(Level.ERROR, null, simple);
+        log(Level.ERROR, null, simple, null);
+        currentEvent = events[11];
+        log(Level.ERROR, simple, t);
+        log(Level.ERROR, null, simple, t);
+        currentEvent = events[12];
+        log(Level.ERROR, MarkerManager.getMarker("TEST"), simple, null);
+        currentEvent = events[13];
+        log(Level.ERROR, MarkerManager.getMarker("TEST"), simple, t);
+        currentEvent = events[14];
+        log(Level.ERROR, MarkerManager.getMarker("TEST"), simple);
+    }
+
+    @Test
+    public void testLogFatal() {
+        currentLevel = Level.FATAL;
+
+        currentEvent = events[0];
+        log(Level.FATAL, "Hello");
+        log(Level.FATAL, null, "Hello");
+        currentEvent = events[1];
+        log(Level.FATAL, MarkerManager.getMarker("TEST"), "Hello");
+        currentEvent = events[2];
+        log(Level.FATAL, "Hello", t);
+        log(Level.FATAL, null, "Hello", t);
+        currentEvent = events[3];
+        log(Level.FATAL, MarkerManager.getMarker("TEST"), "Hello", t);
+        currentEvent = events[4];
+        log(Level.FATAL, obj);
+        currentEvent = events[5];
+        log(Level.FATAL, MarkerManager.getMarker("TEST"), obj);
+        currentEvent = events[6];
+        log(Level.FATAL, obj, t);
+        log(Level.FATAL, null, obj, t);
+        currentEvent = events[7];
+        log(Level.FATAL, MarkerManager.getMarker("TEST"), obj, t);
+        currentEvent = events[8];
+        log(Level.FATAL, pattern, p1, p2);
+        currentEvent = events[9];
+        log(Level.FATAL, MarkerManager.getMarker("TEST"), pattern, p1, p2);
+        currentEvent = events[10];
+        log(Level.FATAL, simple);
+        log(Level.FATAL, null, simple);
+        log(Level.FATAL, null, simple, null);
+        currentEvent = events[11];
+        log(Level.FATAL, simple, t);
+        log(Level.FATAL, null, simple, t);
+        currentEvent = events[12];
+        log(Level.FATAL, MarkerManager.getMarker("TEST"), simple, null);
+        currentEvent = events[13];
+        log(Level.FATAL, MarkerManager.getMarker("TEST"), simple, t);
+        currentEvent = events[14];
+        log(Level.FATAL, MarkerManager.getMarker("TEST"), simple);
+    }
+
+    @Test
+    public void testLogInfo() {
+        currentLevel = Level.INFO;
+
+        currentEvent = events[0];
+        log(Level.INFO, "Hello");
+        log(Level.INFO, null, "Hello");
+        currentEvent = events[1];
+        log(Level.INFO, MarkerManager.getMarker("TEST"), "Hello");
+        currentEvent = events[2];
+        log(Level.INFO, "Hello", t);
+        log(Level.INFO, null, "Hello", t);
+        currentEvent = events[3];
+        log(Level.INFO, MarkerManager.getMarker("TEST"), "Hello", t);
+        currentEvent = events[4];
+        log(Level.INFO, obj);
+        currentEvent = events[5];
+        log(Level.INFO, MarkerManager.getMarker("TEST"), obj);
+        currentEvent = events[6];
+        log(Level.INFO, obj, t);
+        log(Level.INFO, null, obj, t);
+        currentEvent = events[7];
+        log(Level.INFO, MarkerManager.getMarker("TEST"), obj, t);
+        currentEvent = events[8];
+        log(Level.INFO, pattern, p1, p2);
+        currentEvent = events[9];
+        log(Level.INFO, MarkerManager.getMarker("TEST"), pattern, p1, p2);
+        currentEvent = events[10];
+        log(Level.INFO, simple);
+        log(Level.INFO, null, simple);
+        log(Level.INFO, null, simple, null);
+        currentEvent = events[11];
+        log(Level.INFO, simple, t);
+        log(Level.INFO, null, simple, t);
+        currentEvent = events[12];
+        log(Level.INFO, MarkerManager.getMarker("TEST"), simple, null);
+        currentEvent = events[13];
+        log(Level.INFO, MarkerManager.getMarker("TEST"), simple, t);
+        currentEvent = events[14];
+        log(Level.INFO, MarkerManager.getMarker("TEST"), simple);
+    }
+
+    @Test
+    public void testLogTrace() {
+        currentLevel = Level.TRACE;
+
+        currentEvent = events[0];
+        log(Level.TRACE, "Hello");
+        log(Level.TRACE, null, "Hello");
+        currentEvent = events[1];
+        log(Level.TRACE, MarkerManager.getMarker("TEST"), "Hello");
+        currentEvent = events[2];
+        log(Level.TRACE, "Hello", t);
+        log(Level.TRACE, null, "Hello", t);
+        currentEvent = events[3];
+        log(Level.TRACE, MarkerManager.getMarker("TEST"), "Hello", t);
+        currentEvent = events[4];
+        log(Level.TRACE, obj);
+        currentEvent = events[5];
+        log(Level.TRACE, MarkerManager.getMarker("TEST"), obj);
+        currentEvent = events[6];
+        log(Level.TRACE, obj, t);
+        log(Level.TRACE, null, obj, t);
+        currentEvent = events[7];
+        log(Level.TRACE, MarkerManager.getMarker("TEST"), obj, t);
+        currentEvent = events[8];
+        log(Level.TRACE, pattern, p1, p2);
+        currentEvent = events[9];
+        log(Level.TRACE, MarkerManager.getMarker("TEST"), pattern, p1, p2);
+        currentEvent = events[10];
+        log(Level.TRACE, simple);
+        log(Level.TRACE, null, simple);
+        log(Level.TRACE, null, simple, null);
+        currentEvent = events[11];
+        log(Level.TRACE, simple, t);
+        log(Level.TRACE, null, simple, t);
+        currentEvent = events[12];
+        log(Level.TRACE, MarkerManager.getMarker("TEST"), simple, null);
+        currentEvent = events[13];
+        log(Level.TRACE, MarkerManager.getMarker("TEST"), simple, t);
+        currentEvent = events[14];
+        log(Level.TRACE, MarkerManager.getMarker("TEST"), simple);
+    }
+
+    @Test
+    public void testLogWarn() {
+        currentLevel = Level.WARN;
+
+        currentEvent = events[0];
+        log(Level.WARN, "Hello");
+        log(Level.WARN, null, "Hello");
+        currentEvent = events[1];
+        log(Level.WARN, MarkerManager.getMarker("TEST"), "Hello");
+        currentEvent = events[2];
+        log(Level.WARN, "Hello", t);
+        log(Level.WARN, null, "Hello", t);
+        currentEvent = events[3];
+        log(Level.WARN, MarkerManager.getMarker("TEST"), "Hello", t);
+        currentEvent = events[4];
+        log(Level.WARN, obj);
+        currentEvent = events[5];
+        log(Level.WARN, MarkerManager.getMarker("TEST"), obj);
+        currentEvent = events[6];
+        log(Level.WARN, obj, t);
+        log(Level.WARN, null, obj, t);
+        currentEvent = events[7];
+        log(Level.WARN, MarkerManager.getMarker("TEST"), obj, t);
+        currentEvent = events[8];
+        log(Level.WARN, pattern, p1, p2);
+        currentEvent = events[9];
+        log(Level.WARN, MarkerManager.getMarker("TEST"), pattern, p1, p2);
+        currentEvent = events[10];
+        log(Level.WARN, simple);
+        log(Level.WARN, null, simple);
+        log(Level.WARN, null, simple, null);
+        currentEvent = events[11];
+        log(Level.WARN, simple, t);
+        log(Level.WARN, null, simple, t);
+        currentEvent = events[12];
+        log(Level.WARN, MarkerManager.getMarker("TEST"), simple, null);
+        currentEvent = events[13];
+        log(Level.WARN, MarkerManager.getMarker("TEST"), simple, t);
+        currentEvent = events[14];
+        log(Level.WARN, MarkerManager.getMarker("TEST"), simple);
+    }
+
+    @Test
     public void testTrace() {
         currentLevel = Level.TRACE;
 
@@ -402,7 +654,6 @@ public class AbstractLoggerTest extends 
         trace(MarkerManager.getMarker("TEST"), simple);
     }
 
-
     @Test
     public void testWarn() {
         currentLevel = Level.WARN;

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1460661&r1=1460660&r2=1460661&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Mon Mar 25 13:51:32 2013
@@ -23,6 +23,9 @@
 
   <body>
     <release version="2.0-beta5" date="@TBD@" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-179" dev="ggregory" type="add">
+        Add Logger interface APIs to log at given levels.
+      </action>
       <action issue="LOG4J2-181" dev="rgoers" type="fix">
         OutputStreamManager now adds the layout header whenever the OutputStream is set.
       </action>



Mime
View raw message