(0000348)
ferg
07-12-05 00:00
|
File: com.caucho.log.EnvironmentLogger.java. Needs the following code added to it.
/**
* Remove a handler.
*/
public synchronized void removeHandler(Handler handler)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
for (int i = _loaders.size() - 1; i >= 0; i--) {
SoftReference<ClassLoader> ref = _loaders.get(i);
ClassLoader refLoader = ref.get();
if (refLoader == null)
_loaders.remove(i);
if (isParentLoader(loader, refLoader))
removeHandler(handler, refLoader);
}
HandlerEntry ownHandlers = _ownHandlers.get();
if (ownHandlers != null) {
ownHandlers.removeHandler(handler);
}
}
private void removeHandler(Handler handler, ClassLoader loader)
{
ArrayList<Handler> handlers = new ArrayList<Handler>();
for (ClassLoader ptr = loader; ptr != null; ptr = ptr.getParent()) {
Handler []localHandlers = _localHandlers.getLevel(ptr);
if (localHandlers != null) {
for (int i = 0; i < localHandlers.length; i++) {
if (!localHandlers[i].equals(handler)) {
int p = handlers.indexOf(localHandlers[i]);
if (p < 0) {
handlers.add(localHandlers[i]);
}
else {
Handler oldHandler = handlers.get(p);
if (localHandlers[i].getLevel().intValue()
< oldHandler.getLevel().intValue()) {
handlers.set(p, localHandlers[i]);
}
}
}
}
}
}
if (handlers.size() > 0) {
Handler []newHandlers = new Handler[handlers.size()];
handlers.toArray(newHandlers);
_localHandlers.set(newHandlers);
} else {
_localHandlers.remove();
}
if (handler.getLevel().intValue() <= _level)
doSetLevel(getLevel());
} |