JDK-6774110 : lock file is not deleted when child logger is used
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 6u10
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-11-20
  • Updated: 2014-10-10
  • Resolved: 2014-10-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorResolved
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
A logger (with name "com.foo.testing") is defined in the logging properties file. The child logger (with name "com.foo.testing.logging.Logging3") is used inside the source.

During execution, there are 4 files (log, log.lck, log.1 and log.lck), but after the program exits, just log.lck is removed.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. define a logger in logging properties
2. use Logger.getLogger to get a child logger
3. the unwanted lock file remained


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
only one file "log" after program execution
ACTUAL -
log, log.1 and log.1.lck, 3 files remain

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
logging properties :

com.foo.testing.handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

source :
package com.foo.testing.logging;

import java.util.logging.Handler;
import java.util.logging.Logger;

public class Logging3 {
	public static void main(String[] args) {
		Logging3 mainObj = new Logging3();
		mainObj.execute();
	}
	
	private void clean(Logger logger) {
		if (logger != null) {
			for (Handler handler : logger.getHandlers()) {
				handler.close();
			}
			clean(logger.getParent());
		}
	}
	
	private void execute() {
		Logger logger = Logger.getLogger(Logging3.class.getName());
		logger.info("hello world");
		clean(logger);
	}
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Delete unnecessary files explicitly

Comments
The lock handling logic has changed a lot in JDK 8 and JDK 9. This is no longer reproducible on JDK 9 - nor in the nightly of JDK-8u-dev. FWIW I could not reproduce with JDK 7u45 either.
09-10-2014