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

LogManager.readConfiguration does not properly modify existing loggers

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Future Project
    • Icon: P4 P4
    • tbd
    • 1.4.2
    • core-libs



      Name: rmT116609 Date: 04/21/2004


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

      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux 2.4.20-28.8smp #1 SMP Thu Dec 18 12:25:21 EST 2003 i686 i686 i386 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      LogManager.readConfiguration() does not properly adjust the level of some loggers.

      If the config file specifies a level for a logger which hasn't been created in the application, children which already exist do not pick up the change.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the sample app below

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      fooBar.isLoggable(Level.FINE): false
      fooBar.isLoggable(Level.FINE): true
      fooBar.isLoggable(Level.FINE): true

      ACTUAL -
      fooBar.isLoggable(Level.FINE): false
      fooBar.isLoggable(Level.FINE): false
      fooBar.isLoggable(Level.FINE): true


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;
      import java.util.*;
      import java.util.logging.*;

      public class LogTest {

          public static void main(String[] args) throws Throwable {

              printTest(); // prints "false" as expected

              String propString = "foo.level=FINE";
              byte[] propBytes = propString.getBytes();
              LogManager.getLogManager().readConfiguration(new ByteArrayInputStream(propBytes));

              printTest(); // prints "false", incorrectly

              // this causes the foo.bar logger to realize that its level has changed.
              Logger.getLogger("foo");

              printTest(); // now prints "true"
          }

          private static void printTest() {
              Logger fooBar = Logger.getLogger("foo.bar");
              System.out.println("fooBar.isLoggable(Level.FINE): " + fooBar.isLoggable(Level.FINE));
          }

      }

      ---------- END SOURCE ----------
      (Incident Review ID: 250485)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: