1 |
/* LogManager.java |
/* LogManager.java -- a class for maintaining Loggers and managing |
2 |
-- a class for maintaining Loggers and managing configuration |
configuration properties |
3 |
properties |
Copyright (C) 2002 Free Software Foundation, Inc. |
|
|
|
|
Copyright (C) 2002 Free Software Foundation, Inc. |
|
4 |
|
|
5 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
6 |
|
|
34 |
or based on this library. If you modify this library, you may extend |
or based on this library. If you modify this library, you may extend |
35 |
this exception to your version of the library, but you are not |
this exception to your version of the library, but you are not |
36 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
37 |
exception statement from your version. |
exception statement from your version. */ |
38 |
|
|
|
*/ |
|
39 |
|
|
40 |
package java.util.logging; |
package java.util.logging; |
41 |
|
|
43 |
import java.beans.PropertyChangeSupport; |
import java.beans.PropertyChangeSupport; |
44 |
import java.io.IOException; |
import java.io.IOException; |
45 |
import java.io.InputStream; |
import java.io.InputStream; |
46 |
|
import java.lang.ref.WeakReference; |
47 |
import java.net.URL; |
import java.net.URL; |
48 |
import java.util.Collections; |
import java.util.Collections; |
|
import java.util.Properties; |
|
49 |
import java.util.Enumeration; |
import java.util.Enumeration; |
50 |
import java.util.Iterator; |
import java.util.Iterator; |
51 |
import java.util.Map; |
import java.util.Map; |
52 |
|
import java.util.Properties; |
53 |
import java.util.StringTokenizer; |
import java.util.StringTokenizer; |
|
import java.lang.ref.WeakReference; |
|
54 |
|
|
55 |
/** |
/** |
56 |
* The <code>LogManager</code> maintains a hierarchical namespace |
* The <code>LogManager</code> maintains a hierarchical namespace |
348 |
private synchronized Logger findAncestor(Logger child) |
private synchronized Logger findAncestor(Logger child) |
349 |
{ |
{ |
350 |
String childName = child.getName(); |
String childName = child.getName(); |
351 |
|
int childNameLength = childName.length(); |
352 |
Logger best = rootLogger; |
Logger best = rootLogger; |
353 |
int bestNameLength = 0; |
int bestNameLength = 0; |
354 |
|
|
364 |
candName = (String) iter.next(); |
candName = (String) iter.next(); |
365 |
candNameLength = candName.length(); |
candNameLength = candName.length(); |
366 |
|
|
367 |
if ((candNameLength > bestNameLength) |
if (candNameLength > bestNameLength |
368 |
|
&& childNameLength > candNameLength |
369 |
&& childName.startsWith(candName) |
&& childName.startsWith(candName) |
370 |
&& (childName.charAt(candNameLength) == '.')) |
&& childName.charAt(candNameLength) == '.') |
371 |
{ |
{ |
372 |
cand = (Logger) ((WeakReference) loggers.get(candName)).get(); |
cand = (Logger) ((WeakReference) loggers.get(candName)).get(); |
373 |
if ((cand == null) || (cand == child)) |
if ((cand == null) || (cand == child)) |