[Bug 90] New: Missing check for isLoggable in slf4j-jdk14

View: New views
2 Messages — Rating Filter:   Alert me  

[Bug 90] New: Missing check for isLoggable in slf4j-jdk14

by Bugzilla from bugzilla-daemon@pixie.qos.ch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://bugzilla.slf4j.org/show_bug.cgi?id=90

           Summary: Missing check for isLoggable in slf4j-jdk14
           Product: SLF4J
           Version: 1.5.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.0
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: Unspecified
        AssignedTo: dev@...
        ReportedBy: matthew@...


The generic log method in slf4j-jdk14 is missing a wrapper to test if the level
is loggable:

    if (logger.isLoggable(julLevel)) {

Without it, the stack trace elements are getting created from
org.apache.commons.logging.impl.SLF4JLocationAwareLog unconditionally.

I suggest changing this method as follows:

  public void log(Marker marker, String callerFQCN, int level, String message,
      Throwable t) {
    Level julLevel;
    switch (level) {
    case LocationAwareLogger.TRACE_INT:
      julLevel = Level.FINEST;
      break;
    case LocationAwareLogger.DEBUG_INT:
      julLevel = Level.FINE;
      break;
    case LocationAwareLogger.INFO_INT:
      julLevel = Level.INFO;
      break;
    case LocationAwareLogger.WARN_INT:
      julLevel = Level.WARNING;
      break;
    case LocationAwareLogger.ERROR_INT:
      julLevel = Level.SEVERE;
      break;
    default:
      throw new IllegalStateException("Level number " + level
          + " is not recognized.");
    }
    if (logger.isLoggable(julLevel)) {
      log(callerFQCN, julLevel, message, t);
    }
  }


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
dev mailing list
dev@...
http://www.slf4j.org/mailman/listinfo/dev

[Bug 90] Missing check for isLoggable in slf4j-jdk14

by Bugzilla from bugzilla-daemon@pixie.qos.ch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://bugzilla.slf4j.org/show_bug.cgi?id=90


listid@... changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from listid@...  2008-07-31 16:59 -------

Hello Matthew,

Fixed in revision 1085. Good call.


--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
dev mailing list
dev@...
http://www.slf4j.org/mailman/listinfo/dev
LightInTheBox - Buy quality products at wholesale price