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

Logging is broken in Java 7

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.7.0_06"
      Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
      Java HotSpot(TM) Client VM (build 23.2-b09, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Nothing unusual. N/A.

      A DESCRIPTION OF THE PROBLEM :
      Logging levels fine, finer, and finest will not output. Conjecture: Only logging levels info and severe appear to work.

      REGRESSION. Last worked in version 6u31

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Insert an entry in logging.properties for a test program; e.g., TestLogging.TestLogging.level=FINEST
      Execute the code sequence:
      if( logger.isLoggable(Level.FINEST) )
            logger.finest(String.format("Logging level is %s%n", logger.getLevel()));
          else
            logger.info(String.format("Logging is FUBAR and level is %s%n", logger.getLevel()) );
          logger.info(String.format("Logging is totally FUBAR and level is %s%n", logger.getLevel()) );


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      FINEST: Logging level is FINEST
      ACTUAL -
      INFO: Logging is totally FUBAR and level is FINEST

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.logging.Level;
      import java.util.logging.Logger;

      /*
       * @author CElliott
       */
      public class TestLogging {
        private static Logger logger = Logger.getLogger("TestLogging.TestLogging");
        
        public static void main(String[] args) {
          if( logger.isLoggable(Level.FINEST) )
            logger.finest(String.format("Logging level is %s%n", logger.getLevel()));
          else
            logger.info(String.format("Logging is FUBAR and level is %s%n", logger.getLevel()) );
          logger.info(String.format("Logging is totally FUBAR and level is %s%n", logger.getLevel()) );
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There is no workaround, except to restrict usage of logging to levels info and severe. BTW, this is the way logging has always worked if Logger logger = Logger.getAnonymousLogger() is used. I am not sure if this is correct.

            jgish Jim Gish (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: