JDK-8156205 : Release Note: Changes in logging interface in MXBean
  • Type: Sub-task
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2016-05-06
  • Updated: 2017-09-22
  • Resolved: 2017-02-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
Relates :  
In Java SE 9 the `java.util.logging.LoggingMXBean` interface is deprecated in favor of the `java.lang.management.PlatformLoggingMXBean` interface.
The `java.util.logging.LogManager.getLoggingMXBean()` method is also deprecated in favor of `java.lang.mangement.ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)`.

The concrete implementation of the logging MXBean registered in the MBeanServer and obtained from the ManagementFactory will only implement `java.lang.management.PlatformLoggingMXBean`, and no longer `java.util.logging.LoggingMXBean`. It must be noted that `PlatformLoggingMXBean` and `LoggingMXBean` attributes are exactly the same. The `PlatformLoggingMXBean` interface has all the methods defined in `LoggingMXBean`, and so `PlatformLoggingMXBean` by itself provides the full management capability of logging facility.

This should be mostly transparent to remote and local clients of the API.


Calls to `ManagementFactory.newPlatformMXBeanProxy(MBeanServerConnection, ObjectName, java.util.logging.LoggingMXBean.class)`
and calls to `JMX.newMXBeanProxy(MBeanServerConnection, ObjectName, java.util.logging.LoggingMXBean.class)` will continue to work as before.
Remote clients running any version of the JDK should see no changes, except for the interface name in `MBeanInfo`, and the change in `isInstanceOf`
reported in 1. and 2. below.
The behavioral change and source incompatibility due to this change are as follows:
   1. `ManagementFactory.getPlatformMBeanServer().isInstanceOf(ObjectName, "java.util.logging.LoggingMXBean")` will now return '`false`' instead of '`true`'.<br>
       If an application depends on this, then a  workaround is to change the source of the calling code to check for `java.lang.management.PlatformLoggingMXBean` instead.
   2. The Logging MXBean `MBeanInfo` will now report that its management interface is `java.lang.management.PlatformLoggingMXBean` instead of the non standard `sun.management.ManagementFactoryHelper$LoggingMXBean` name it used to display.<br>
      The new behavior has the advantage that the reported interface name is now a standard class.
   3. Local clients which obtain an instance of the logging MXBean by calling `ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)` will no longer be able to cast the result to `java.util.logging.LoggingMXBean`.<br>
     `PlatformLoggingMXBean`  already has all the methods defined in `LoggingMXBean`, therefore a simple workaround is to change the code to accept `PlatformLoggingMXBean` instead - or change it to use the deprecated `LogManager.getLoggingMXBean()` instead.