Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4823739

RFE: java.util.logging.Logger lacks some convenience methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Future Project
    • Icon: P4 P4
    • None
    • 1.4.1
    • core-libs



      Name: rmT116609 Date: 02/25/2003


      DESCRIPTION OF THE PROBLEM :
      The Logger class lacks convenience methods with the name of the standard levels and that also take an exception as parameter. Acording to the javadoc, these methods only exists with a simple parameter:

       Finally, there are a set of convenience methods for use in the very simplest cases, when a developer simply wants to log a simple string at a given log level. These methods are named after the standard Level names ("severe", "warning", "info", etc.) and take a single argument, a message string.


      It would be really helpful though if they were overriden to receive an exception too.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      expected: methods

      severe( String msg, Throwable t )
      warning( String msg, Throwable t )
      info( String msg, Throwable t )
      fine( String msg, Throwable t )
      finer( String msg, Throwable t )
      finest( String msg, Throwable t )
      config( String msg, Throwable t )

      CUSTOMER WORKAROUND :
      The work around is to use the normal log method, which is not useful. For instance, instead of:

      logger.warning( "database error", exc );


      it is necessary to code:

      logger.log( java.util.logging.Level.WARNING, "database error", exc );

      I know there is a throwing method that does something similar, but that's not the same, as this method will always use the level FINER.
      (Review ID: 181775)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: