Bug 29137

Summary: Logger parent not updated when new parent appears in namespace
Product: classpath Reporter: Mark Wielaard <mark>
Component: classpathAssignee: Mark Wielaard <mark>
Status: RESOLVED FIXED    
Severity: normal CC: bug-classpath
Priority: P3    
Version: unspecified   
Target Milestone: 0.93   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Mark Wielaard 2006-09-19 10:05:16 UTC
In the following code both ab and ac should have the same parent a, but they don't:

import java.util.logging.*;

public class t
{
  public static void main(String[] args) throws Exception
  {
    Logger ab = Logger.getLogger("a.b");
    Logger a = Logger.getLogger("a");
    Logger ac = Logger.getLogger("a.c");
    System.out.println("a: " + a);
    System.out.println("ab parent: " + ab.getParent());
    System.out.println("ac parent: " + ac.getParent());
  }
}

ac has a as parent, but ab doesn't.

This seems to be caused by the following guard in LogManager.addLogger():

      * When adding "foo.bar", the logger "foo.bar.baz" should change
      * its parent to "foo.bar".
      */
     if (parent != Logger.root)

That if statement seems wrong.
Comment 1 cvs-commit@developer.classpath.org 2006-09-19 10:43:15 UTC
Subject: Bug 29137

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Changes by:	Mark Wielaard <mark>	06/09/19 10:41:45

Modified files:
	.              : ChangeLog 
	java/util/logging: LogManager.java 

Log message:
	       Fixes bug #29137
	       * java/util/logging/LogManager.java (addLogger): Always check for
	       existing children of a new Logger.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.8566&r2=1.8567
http://cvs.savannah.gnu.org/viewcvs/classpath/java/util/logging/LogManager.java?cvsroot=classpath&r1=1.23&r2=1.24



Comment 2 Mark Wielaard 2006-09-19 10:45:06 UTC
Fixed checked in and mauve test added.
Comment 3 Tom Tromey 2006-09-19 16:23:43 UTC
Subject: Bug 29137

Author: tromey
Date: Tue Sep 19 16:23:34 2006
New Revision: 117058

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117058
Log:
2006-09-19  Mark Wielaard  <mark@klomp.org>

	Fixes bug #29137
	* java/util/logging/LogManager.java (addLogger): Always check for
	existing children of a new Logger.

2006-09-19  Tom Tromey  <tromey@redhat.com>

	* java/util/logging/LogManager.java: Re-merged with Classpath.

Modified:
    trunk/libjava/ChangeLog
    trunk/libjava/java/util/logging/LogManager.java