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

java.sql.DriverManager - Initial log output in static block is lost

    XMLWordPrintable

Details

    • 7
    • b137
    • x86_64
    • windows_7
    • Not verified

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_92"
      Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      It is not possible to get the information printed by loadInitialDrivers().

      The only way to get the logs is to set a the logWriter / logStream.
      Since loadInitialDrivers() is only called in the static{} block, before setting the logWriter, the information is lost.

      REGRESSION. Last worked in version 6u45

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      System.out:
      JdbcOdbcDriver class loaded
      registerDriver: driver[className=sun.jdbc.odbc.JdbcOdbcDriver,sun.jdbc.odbc.JdbcOdbcDriver@5e743399]
      DriverManager.initialize: jdbc.drivers = null
      JDBC DriverManager initialized

      ACTUAL -
      System.out:
      (nothing)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package bug.reproduce;

      import java.io.PrintWriter;
      import java.sql.Driver;
      import java.sql.DriverManager;
      import java.util.Enumeration;

      public class DriverManager_noInitialLog {

      public static void main(String[] args) {
      // Setup the LogWriter
      DriverManager.setLogWriter(new PrintWriter(System.out));
      // get the Drivers
      Enumeration<Driver> drivers = DriverManager.getDrivers();
      }

      }
      ---------- END SOURCE ----------

      Attachments

        Activity

          People

            lancea Lance Andersen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: