On 10/15/2013 9:48 AM, Daniel Fuchs wrote:
Hi,

Please find below a fix for:

    8026499: Root Logger level can be reset unexpectedly
    https://bugs.openjdk.java.net/browse/JDK-8026499

<http://cr.openjdk.java.net/~dfuchs/webrev_8026499/webrev.00/>

The issue here is that calling a method like e.g. URL.openConnection()
will trigger the initialization of some platform logger, which could
in turn cause the root logger to be lazilly added to the system context,
which in turn causes the root logger's level to be reset with the
value found in the configuration file (INFO).

The fix is to not reinitialize the value of the logger's level if
it already has been initialized.

The change looks okay. When the root logger is added to the system context, it considers it as a newly created logger and thus resetting its level. The global logger should have the same issue as there is only a single instance. I believe the logger's handler doesn't get reset and level is the only issue.

Logger.hasLocalLevel() doesn't seem to be necessary and it seems to be more explicit to replace !logger.hasLocalLevel() with
    logger.getLevel() == null

It would also help to add a comment to explain the check.

TestRootLoggerLevel.java - it may be good to also test the global logger.

line 70: I believe this line is not necessary (do you mean to do any other checking and that's why you call LoggingSupport.getLogger?)

I think the comment on the behavior before the fix (line 77-78) can be removed and this may become not as relevant after this bug fix. Line 104 - this permission may be needed in your early version of this test? can be removed now? btw - should this test also run with no security manager?

Mandy


Reply via email to