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

%t doesn't work when logging to temp dir in Windows XP

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.4.1
    • core-libs



      Name: nt126004 Date: 03/03/2003


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

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows XP [Version 5.1.2600]


      A DESCRIPTION OF THE PROBLEM :
      logging API does not create log file using %t in pattern

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. compile and execute program as is
      2. verify log file exists
      3. change only %h to %t
      4. recompile and execute

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      cannot find log file, even when DOS is shut down during a
      pause in the program

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.logging.*;
      import java.io.IOException;
      class Test {
         static Logger logger = Logger.getAnonymousLogger();
         static {
            logger.setLevel(Level.ALL);
            logger.setUseParentHandlers(false);
            try {
                 Handler fileHandler = new FileHandler("%t/test.log");
                 fileHandler.setLevel(Level.ALL);
                 fileHandler.setFormatter(new SimpleFormatter());
                 logger.addHandler(fileHandler);
            } catch(IOException ioe) {
                 Handler consoleHandler = new ConsoleHandler();
                 consoleHandler.setLevel(Level.CONFIG);
                 logger.addHandler(consoleHandler);
                 logger.log(Level.CONFIG, "cannot instantiate FileHandler " +
                            "using \"%t/test.log\" pattern", ioe);
            }
         }
         public static void main(String[] args) {
            logger.entering("Test", "main(String[] args)", args);
            //System.out.println("kill program now");
            //long t = System.currentTimeMillis() + 20000;
            //while(System.currentTimeMillis() < t); // delay
            //System.out.println("too late");
            logger.exiting("Test", "main(String[] args)");
         }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      do not write logs to temporary directory
      (Review ID: 158699)
      ======================================================================

            ghamiltosunw Graham Hamilton (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: