Log4j 2
  1. Log4j 2
  2. LOG4J2-179

Add Logger interface APIs to log at given levels

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta4
    • Fix Version/s: 2.0-beta5
    • Component/s: None
    • Labels:

      Description

      The interface org.apache.logging.log4j.Logger contains the method boolean "isEnabled(Level level)" which is very nice.

      I would have expected it to also contain the following methods:

      boolean isEnabled(Level level, Marker marker);
      void log(Level level, Marker marker, Message msg);
      void log(Level level, Marker marker, Message msg, Throwable t);
      void log(Level level, Marker marker, Object message);
      void log(Level level, Marker marker, Object message, Throwable t);
      void log(Level level, Marker marker, String message);
      void log(Level level, Marker marker, String message, Object... params);
      void log(Level level, Marker marker, String message, Throwable t);
      void log(Level level, Message msg);
      void log(Level level, Message msg, Throwable t);
      void log(Level level, Object message);
      void log(Level level, Object message, Throwable t);
      void log(Level level, String message);
      void log(Level level, String message, Object... params);
      void log(Level level, String message, Throwable t);
      (i.e. every method defined for an explicit level but just with an Level as the first argument)

      That way it would be easier to log at a variable level in cases where the level to be used can only be determined at runtime.

        Activity

        Hide
        Ralph Goers added a comment -

        I encourage you to provide the patch.

        Show
        Ralph Goers added a comment - I encourage you to provide the patch.
        Hide
        Gary Gregory added a comment -
        commit -m "[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'.)" C:/svn/org/apache/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java C:/svn/org/apache/log4j2/trunk/src/changes/changes.xml C:/svn/org/apache/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java C:/svn/org/apache/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
            Sending        C:/svn/org/apache/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java
            Sending        C:/svn/org/apache/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
            Sending        C:/svn/org/apache/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java
            Sending        C:/svn/org/apache/log4j2/trunk/src/changes/changes.xml
            Transmitting file data ...
            Committed revision 1460661.
        
        Show
        Gary Gregory added a comment - commit -m "[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'.)" C:/svn/org/apache/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java C:/svn/org/apache/log4j2/trunk/src/changes/changes.xml C:/svn/org/apache/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java C:/svn/org/apache/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java Sending C:/svn/org/apache/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Logger.java Sending C:/svn/org/apache/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java Sending C:/svn/org/apache/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/AbstractLoggerTest.java Sending C:/svn/org/apache/log4j2/trunk/src/changes/changes.xml Transmitting file data ... Committed revision 1460661.
        Hide
        Gary Gregory added a comment -

        Note that I left out:

        boolean isEnabled(Level level, Marker marker);

        I do not want to take the time to do this one now. Patches welcome.

        Show
        Gary Gregory added a comment - Note that I left out: boolean isEnabled(Level level, Marker marker); I do not want to take the time to do this one now. Patches welcome.
        Hide
        Gary Gregory added a comment -

        Not implemented yet: boolean isEnabled(Level level, Marker marker);

        Show
        Gary Gregory added a comment - Not implemented yet: boolean isEnabled(Level level, Marker marker);
        Hide
        Ralph Goers added a comment -

        I added isEnabled(Level, Marker) in revision 1470226.

        Show
        Ralph Goers added a comment - I added isEnabled(Level, Marker) in revision 1470226.

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Joern Huxhorn
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development