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

Daniel Fuchs daniel.fuchs at oracle.com
Fri Jul 1 14:09:02 UTC 2016


Hi Mandy,

On 30/06/16 19:23, Mandy Chung wrote:
> Looks pretty good. What if the application logger is a custom Logger subclass?  Would this mechanism support that?

Yes - this is taken into account, but there are
limitations: by design only data that has been set by
calling the super class setter will be taken into account.

> One small comment:
>
>  577         if (logger != sysLogger && !logger.isConfigMerged(sysLogger)) {
>  578             // if logger already exists we will merge the two configurations.
>                  :
>  587         }
>
> I suggest to hide the body and isConfigMerged check in Logger in a single method:
>    if (logger != sysLogger) {
>        logger.mergeWithSystemLogger(sysLogger);
>    }

OK. I was concerned about the cost of creating a doPrivileged call
for nothing - but then reflected that system classes usually call
getLogger only once for a specific logger - at which point the
doPrivileged will be needed anyway (only for subsequent calls
of getLogger with the same name would it be superfluous).

Here is the new webrev:

http://cr.openjdk.java.net/~dfuchs/webrev_8159245/webrev.06/

cheers,

-- daniel

>
> Mandy



More information about the core-libs-dev mailing list