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

lock file is not deleted when child logger is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • tbd
    • 6u10
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.6.0_10"
      Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
      Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      A logger (with name "com.foo.testing") is defined in the logging properties file. The child logger (with name "com.foo.testing.logging.Logging3") is used inside the source.

      During execution, there are 4 files (log, log.lck, log.1 and log.lck), but after the program exits, just log.lck is removed.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. define a logger in logging properties
      2. use Logger.getLogger to get a child logger
      3. the unwanted lock file remained


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      only one file "log" after program execution
      ACTUAL -
      log, log.1 and log.1.lck, 3 files remain

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      logging properties :

      com.foo.testing.handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
      java.util.logging.FileHandler.pattern = log
      java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
      java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

      source :
      package com.foo.testing.logging;

      import java.util.logging.Handler;
      import java.util.logging.Logger;

      public class Logging3 {
      public static void main(String[] args) {
      Logging3 mainObj = new Logging3();
      mainObj.execute();
      }

      private void clean(Logger logger) {
      if (logger != null) {
      for (Handler handler : logger.getHandlers()) {
      handler.close();
      }
      clean(logger.getParent());
      }
      }

      private void execute() {
      Logger logger = Logger.getLogger(Logging3.class.getName());
      logger.info("hello world");
      clean(logger);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Delete unnecessary files explicitly

            dfuchs Daniel Fuchs
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: