52 |
import java.util.Enumeration; |
import java.util.Enumeration; |
53 |
import java.util.Iterator; |
import java.util.Iterator; |
54 |
import java.util.Map; |
import java.util.Map; |
55 |
|
import java.util.StringTokenizer; |
56 |
import java.lang.ref.WeakReference; |
import java.lang.ref.WeakReference; |
57 |
|
|
58 |
/** |
/** |
168 |
* the order in which classes are initialized. |
* the order in which classes are initialized. |
169 |
*/ |
*/ |
170 |
Logger.getLogger("global").setParent(rootLogger); |
Logger.getLogger("global").setParent(rootLogger); |
171 |
|
Logger.getLogger("global").setUseParentHandlers(true); |
172 |
} |
} |
173 |
|
|
174 |
|
|
522 |
|
|
523 |
public synchronized void readConfiguration(InputStream inputStream) |
public synchronized void readConfiguration(InputStream inputStream) |
524 |
throws IOException, SecurityException |
throws IOException, SecurityException |
525 |
{ |
{ |
526 |
Properties newProperties; |
Properties newProperties; |
527 |
Enumeration keys; |
Enumeration keys; |
528 |
|
|
534 |
|
|
535 |
while (keys.hasMoreElements()) |
while (keys.hasMoreElements()) |
536 |
{ |
{ |
537 |
String key = (String) keys.nextElement(); |
String key = ((String) keys.nextElement()).trim(); |
538 |
String value = newProperties.getProperty(key); |
String value = newProperties.getProperty(key); |
539 |
|
|
540 |
if (value == null) |
if (value == null) |
541 |
continue; |
continue; |
542 |
|
|
543 |
|
value = value.trim(); |
544 |
|
|
545 |
|
if("handlers".equals(key)) |
546 |
|
{ |
547 |
|
StringTokenizer tokenizer = new StringTokenizer(value); |
548 |
|
while(tokenizer.hasMoreTokens()) |
549 |
|
{ |
550 |
|
String handlerName = tokenizer.nextToken(); |
551 |
|
try |
552 |
|
{ |
553 |
|
Class handlerClass = Class.forName(handlerName); |
554 |
|
getLogger("").addHandler((Handler)handlerClass.newInstance()); |
555 |
|
} |
556 |
|
catch (ClassCastException ex) |
557 |
|
{ |
558 |
|
System.err.println("[LogManager] class " + handlerName + " is not subclass of java.util.logging.Handler"); |
559 |
|
} |
560 |
|
catch (Exception ex) |
561 |
|
{ |
562 |
|
//System.out.println("[LogManager.readConfiguration]"+ex); |
563 |
|
} |
564 |
|
} |
565 |
|
} |
566 |
|
|
567 |
if (key.endsWith(".level")) |
if (key.endsWith(".level")) |
568 |
{ |
{ |
569 |
String loggerName = key.substring(0, key.length() - 6); |
String loggerName = key.substring(0, key.length() - 6); |
576 |
} |
} |
577 |
catch (Exception _) |
catch (Exception _) |
578 |
{ |
{ |
579 |
|
//System.out.println("[LogManager.readConfiguration] "+_); |
580 |
} |
} |
581 |
continue; |
continue; |
582 |
} |
} |