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

java.util.logging Handler publish method should throw an exception

XMLWordPrintable

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

      A DESCRIPTION OF THE REQUEST :
      In java.util.logging handlers publish method should throw a consistent exception if they are unable to log. If they already do so, this exception should be part of the JavaDoc.

      JUSTIFICATION :
      In situations where logging needs to happen, the system may need to take any/all corrective action to ensure that logging takes place. At my company we are trying to use logging for non-repudiation. If I logging that should occur does not, I will not know that my non-reputable log is incomplete

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Ultimately, all log methods should catch any exception thrown by a handler and throw a logging exception to the calling application. The calling application can suppress the exception or act on it (send an email, write to console, whatever)

      I should be able to say
      try{
      logger.info("this is the log message");
      }catch (exception ex){
      //send an email or accumulate logging errors or whatever
      }
      ACTUAL -
      logging does not occur

      ---------- BEGIN SOURCE ----------
      //map a drive to z:

      //configure a logger
      FileHandler myFileHandler = new FileHandler("z:\logs\mytest.log");
      Logger logger = Logger.getLogger("mylogger");
      logger.setUseParentHandlers(false);
      logger.addHandler(myFileHandler );

      //disconnect the mapping to drive z:
      logger.info("this is the log message");
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I do not know how to bypass this behavior.

            Unassigned Unassigned
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: