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

Mandy Chung mandy.chung at oracle.com
Thu Jun 30 18:23:46 UTC 2016


> On Jun 30, 2016, at 9:33 AM, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
> 
> Indeed, good catch! I should have seen that :-(
> 
> Here is a patch that should take care of the issue:
> 
> http://cr.openjdk.java.net/~dfuchs/webrev_8159245/webrev.05
> 
> Thanks for your offline suggestions on how to deal with that
> scenario.
> 

Looks pretty good. What if the application logger is a custom Logger subclass?  Would this mechanism support that?

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);
   }

Mandy


More information about the core-libs-dev mailing list