RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code.

Hamlin Li huaming.li at oracle.com
Tue Jun 21 03:29:18 UTC 2016


Hi Daniel,

I just has one simple question.
In new version, in Logger::importConfig, userParentHandlers, filter, 
levelObject are copied from other(ConfigurationData) unconditionally, 
handlers in other are only *copied *when it's empty in system.
In previous version, handlers in other are *added *(which means merge 2 
set of handlers)**unconditionally.
is this different behavior expected?

Thank you
-Hamlin

On 2016/6/21 0:34, Daniel Fuchs wrote:
> 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