JDK-6774110 lock file is not deleted when child logger is used

Jason Mehrens jason_mehrens at hotmail.com
Thu Oct 9 19:56:47 UTC 2014


The evaluation on this bug is not quite correct.  What is going on here is the child logger is garbage collected which makes the FileHandler unreachable from the LogManager$Cleaner which would have closed the attached FileHandler.  In the example, there is no hard reference that escapes the 'execute' method.  Prior to fixing JDK-6274920: JDK logger holds strong reference to java.util.logging.Logger instances, the LogManager$Cleaner would have deleted the lock file on shutdown.  Now that the loggers are GC'able, one possible fix would be change the FileHandler.locks static field to Map<String,FileHandler> where the key is the file name and the value is the FileHandler that is open.  Then in the LogManager$Cleaner could close any entries in that map after LogManager.reset() is executed.


More information about the core-libs-dev mailing list