8010309 : PlatformLogger: isLoggable performance / waste due to HashMap<Integer, Level> leads to Integer allocations (boxing)

Peter Levart peter.levart at gmail.com
Thu Mar 21 15:11:36 UTC 2013


On 03/21/2013 03:45 PM, Peter Levart wrote:
> But your concern might be correct. In my code LevelEnum is also used 
> from the LoggerProxy.format() method (in addition to all the places in 
> JavaLogger) to obtain the level name for formatting. If this method is 
> called the first time while LoggingSupport.isAvailable() returns false 
> and that happens before JavaLogger uses LevelEnum for the first time 
> (and at that time LoggingSupport.isAvailable() would return true), 
> then level objects will not be initialized correctly.

Hi Laurent,

In addition, the following sole PlatformLogger constructor:

     private PlatformLogger(String name) {
         if (loggingEnabled) {
             this.logger = new JavaLogger(name);
         } else {
             this.logger = new LoggerProxy(name);
         }
     }


... indicates that either JavaLogger objects or LoggerProxy objects are 
used but not both (since loggingEnabled is static final). So the above 
concern is ungrounded.

Regards, Peter




More information about the core-libs-dev mailing list