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

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        4d 52m 1 Gary Gregory 25/Mar/13 13:52
        Resolved Resolved Reopened Reopened
        10m 28s 1 Gary Gregory 25/Mar/13 14:02
        Reopened Reopened Resolved Resolved
        26d 6h 29m 1 Ralph Goers 20/Apr/13 21:32
        Ralph Goers made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Assignee Ralph Goers [ ralph.goers@dslextreme.com ]
        Resolution Fixed [ 1 ]
        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.
        Gary Gregory made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        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
        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.
        Gary Gregory made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0-beta5 [ 12323970 ]
        Resolution Fixed [ 1 ]
        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.
        Gary Gregory made changes -
        Field Original Value New Value
        Summary Logger interface is lacking methods for logging at variable level Add Logger interface APIs to log at given levels
        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.
        Joern Huxhorn created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development