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

RFE: LogManager.readConfiguration(Properties p) not present

XMLWordPrintable

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



      Name: rmT116609 Date: 01/30/2003


      DESCRIPTION OF THE PROBLEM :
      In java.util.logging.LogManager there is a method readConfiguration(InputStream is) that reads properties in the form of java.util.Properties. Often, I have a Properties object already in memory, for example, when a servlet (loaded at startup) reads all the configuration data for the entire webapp from an XML file. Now I have to store the Properties object in a ByteArrayOutputStream and feed a ByteArrayInputStream to LogManager.readConfiguration(InputStream is). This works, but is not very elegant. To me, a
      LogManager.readConfiguration(Properties p) seems a logical enhancement to the Logging API.

      ---------- BEGIN SOURCE ----------
      public static void configure(Properties p) {
        java.util.logging.LogManager.getLogManager().readConfiguration(p);
      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      public static void configure(Properties p) {
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      ByteArrayInputStream is;
      byte[] buf;
      try {
      p.store(os, "logging");
      buf = os.toByteArray();
      is = new ByteArrayInputStream(buf);

      java.util.logging.LogManager.getLogManager().readConfiguration(is);
      } catch(IOException e) {
      System.out.println("ERROR: Failed to configure
      java.util.logging.LogManager");
      }
      }
      (Review ID: 180570)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: