RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code.
Daniel Fuchs
daniel.fuchs at oracle.com
Mon Jun 20 16:34:36 UTC 2016
Hi,
Please find below a patch for:
8159245: Loggers created by system classes are not initialized
correctly when configured programmatically from
application code.
Issue:
https://bugs.openjdk.java.net/browse/JDK-8150173
Patch:
http://cr.openjdk.java.net/~dfuchs/webrev_8159245/webrev.00/index.html
When an application requests a logger by name, we do not know before
hand whether that corresponds to a system logger name or not.
So if no system logger by that name already exists, we simply return an
application logger.
The issue happens if a system class later requests a system logger
of the same name. The current implementation would simply copy over
the user logger handlers to the system logger, ignoring any other
data (level, filter, flags) that might have been set by the application
(with permission checks) prior to the creation of the system logger.
The proposed patch ensures instead that if a system class later
requests a system logger of the same name, then the application logger
and system logger configurations will be merged in a single instance of
a private static Logger$ConfigurationData value class that both loggers
will share.
A new test is added to verify that the configuration issue is fixed in
the various possible configuration cases:
- parent of system logger created by the application before system
logger exists,
- parent of system logger created by the application after system
logger exists,
- logger created by the application before system logger of the
same name exists
- logger created by the application after system logger of the
same name exists
- all of the above with and without a security manager.
The new test will fail without the fix and pass with it.
best regards,
-- daniel
More information about the core-libs-dev
mailing list