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

LOGGING APIs: LogManager ignores java.util.logging.config.class

XMLWordPrintable

    • generic
    • generic



      Name: elR10090 Date: 09/24/2001



      The following test shows that LogManager ignores
      java.util.logging.config.class property and reads configuration from
      default file (jre/lib/logging.properties) during creation of LogManager
      instance.

      The spec (Merlin-b80) from LogManager class says:

          In addition, the LogManager uses two optional system properties that
          allow more control over reading the initial configuration:

             "java.util.logging.config.class"
             "java.util.logging.config.file"
             
          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.

          If the "java.util.logging.config.class" property is set, then the
          property value is treated as a class name. The given class will be
          loaded, an object will be instantiated, and that object's constructor
          is responsible for reading in the initial configuration. (That object
          may use other system properties to control its configuration.)
          
          If "java.util.logging.config.class" property is *not* set, then the
          "java.util.logging.config.file" system property can be used to specify
          a properties file (in java.util.Properties format). The initial logging
          configuration will be read from this file.
          
      The failure was observed on all platforms since Merlin-b70.
          
      See the test code and its output:
          
      import java.util.logging.*;
      import java.io.*;

      public class Test {
          static LogManager manager;
          static boolean wasHere = false;

          public static void main(String args[]) {
              System.setProperty("java.util.logging.config.class", "Test$Config");
              manager = LogManager.getLogManager();
              
              System.out.println("wasHere = " + wasHere);
          }

          public static class Config {
              public Config() {
                  wasHere = true;
              }
          }
      }

      % .../jdk1.4.0beta-b69/solx86/bin/java -Xbootclasspath/a:. Test
      wasHere = true
      % .../jdk1.4.0beta-b70/solx86/bin/java -Xbootclasspath/a:. Test
      wasHere = false
      % .../jdk1.4.0beta-b80/solx86/bin/java -Xbootclasspath/a:. Test
      wasHere = false

      This bug affects the following test from testbase_nsk:

          nsk/logging/LogManager/readConfiguration/readcfg003
          
      ======================================================================

            ghamiltosunw Graham Hamilton (Inactive)
            latkinsunw Latkin Latkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: