United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6585429 LoggerTraceListener causes infinite loop under some circumstances
JDK-6585429 : LoggerTraceListener causes infinite loop under some circumstances

Details
Type:
Bug
Submit Date:
2007-07-25
Status:
Resolved
Updated Date:
2011-01-27
Project Name:
JDK
Resolved Date:
2010-07-06
Component:
deploy
OS:
generic
Sub-Component:
deployment_toolkit
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
The LoggerTraceListener causes infinite loops in debugging output when the user's jre/lib/logging.properties is modified to increase the amount of output processed by the ConsoleHandler:

java.util.logging.ConsoleHandler.level = FINEST

Roughly, what happens is that some logger causes output to be printed to its implicit ConsoleHandler. The deployment code's interception of stdout and stderr in the Trace code causes this output to be handed to each TraceListener. The LoggerTraceListener receives the output and passes it to its internal Logger, which causes it to be printed to its implicit ConsoleHandler, and the process repeats.

This prevents logging from working effectively in the context of the deployment technologies (Java Web Start and the Java Plug-In) since much logging code in the Java SE workspace is sent at a lower level than the default INFO level the logging ConsoleHandler is set to.

Thanks to ###@###.### for pointing out approximately where in the code the problem was.

                                    

Comments
SUGGESTED FIX

*** /tmp/geta15733	Wed Jul 25 14:43:51 2007
--- LoggerTraceListener.java	Wed Jul 25 14:35:37 2007
***************
*** 24,29 ****
--- 24,33 ----
  
  	// Create logger object
  	logger = Logger.getLogger(loggerName);
+         // Prevent this logger from sending output to its parent handlers
+         // to prevent infinite loops when logging and tracing are enabled
+         // and java.util.logging.ConsoleHandler.level is below a certain level
+         logger.setUseParentHandlers(false);
  	
  	try {
  	    handler = new FileHandler(filename, (Config.getIntProperty(Config.MAX_SIZE_FILE_KEY) * 1048576 ), 1);
                                     
2007-07-25
EVALUATION

The internal Logger object the LoggingTraceListener creates should not send its output to its parent handlers, and from there implicitly the ConsoleHandler.
                                     
2007-07-25



Hardware and Software, Engineered to Work Together