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

LogManager not using java.util.logging.config.class Preference

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs



      Name: jl125535 Date: 05/24/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      Confirmed on Solaris 8 with JDK 1.4.

      A DESCRIPTION OF THE PROBLEM :
      LogManager documentation says:
      <ul>
       <li>"java.util.logging.config.class"
       <li>"java.util.logging.config.file"
       </ul>
       These two properties may be set via the Preferences API, or as
       command line property definitions to the "java" command, or as
       system property definitions passed to JNI_CreateJavaVM.

      It does not say how to set java.util.logging.config.class
      using the Preferences API, and doesn't work for all the
      obvious ways of using the Preferences API.

      I have looked through the source code for LogManager and it
      doesn't look like it is even trying to use the Preferences
      API as documented.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected:
      LogManager.readConfiguration() should report an error in trying to
      load "Non Existent Class!".

      Actual:
      No error is reported, even though the program confirms that
      the java.util.logging.config.class is set to "Non Existent Class!"
      and "/Non /Existent /Class!" appears in the registry


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.IOException;
      import java.util.prefs.Preferences;
      import java.util.logging.LogManager;

      public class Test {
        public static void main(String args[]) {
          Preferences.systemRoot().put("java.util.logging.config.class",
                      "Non Existent Class!");
          
          System.out.println("pref = " +
            Preferences.systemRoot().get("java.util.logging.config.class",
                                         "Pref Not Found!"));
          try {
            // make sure that it is trying to use the new class
            LogManager.getLogManager().readConfiguration();
          }
          catch (IOException ex) {}
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      use System properties instead of Preferences
      (Review ID: 146509)
      ======================================================================

            caustinsunw Calvin Austin (Inactive)
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: