Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8033661

readConfiguration does not cleanly reinitialize the logging system

XMLWordPrintable

        FULL PRODUCT VERSION :
        java version "1.7.0_11"
        Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
        Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        A DESCRIPTION OF THE PROBLEM :
        The java.util.logging.LogManager#readConfiguration(InputStream) method has a flaw, which I found by debugging through the JDK Code because I missed log messages. It does not reinitialize the logging system properly.

        What I found (maybe there is more) is, that it does not load per-logger handlers and does not reset / set the useParentHandlers property. readConfiguration first resets all loggers, removing the handlers amongst other things and then forgets to check for per-logger handlers. Because of that any messages sent to per-logger handlers are lost. And if you switched off useParentHandlers on a log level and call readConfiguration, the messages are of course swalled completely.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        You find two examples for reproducing the issue at http://stackoverflow.com/questions/16441467/use-of-readconfiguration-method-in-logging-activities where also my (Vampire) answer is added.


        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        Either

        - Do not use per-logger handlers in your log configuration file
        - Do not call readConfiguration() or readConfiguration(InputStream), but store the configuration in a file and load it on JVM startup
        - Configure your logging through API calls

              dfuchs Daniel Fuchs
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: