RFR: 7184195 - java.util.logging.Logger.getGlobal().info() doesn't log without configuration (original) (raw)

Jim Gish jim.gish at oracle.com
Wed Oct 24 23:13:39 UTC 2012


Please review http://cr.openjdk.java.net/~jgish/Bug7184195-global-logger-init-fix/ <http://cr.openjdk.java.net/%7Ejgish/Bug7184195-global-logger-init-fix/>

In JDK7, Logger.global was deprecated because of potential deadlock problems. The method getGlobal() was introduced as a convenience method to get the global logger in lieu of this or calling Logger.getLogger(Logger.GLOBAL_LOGGER_NAME). Unfortunately, this was broken out of the gate. getGlobal() simply used the deprecated static variable global, but this had the result of returning the global logger without initializing the logging system. As a result, simply calling Logger.getGlobal().INFO("msg") does nothing. So much for the convenience of a simple global logger for devs to use ootb without any setup required.

This simple fix simply returns Logger.getLogger(Logger.GLOBAL_LOGGER_NAME) when getGlobal() is called and hence results in proper setup of the logging sytem /and /a working global logger with no "assembly" required :-)

Thanks, Jim

-- Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304 Oracle Java Platform Group | Core Libraries Team 35 Network Drive Burlington, MA 01803 jim.gish at oracle.com



More information about the core-libs-dev mailing list