diff options
author | mwebster <mwebster> | 2006-07-27 09:30:17 +0000 |
---|---|---|
committer | mwebster <mwebster> | 2006-07-27 09:30:17 +0000 |
commit | db06666e1c5858bdc4e6fb0c43ec2d74efd649f2 (patch) | |
tree | a97ae037a3dfe55839848f1a8bc22a9dc9c4f0f7 /weaver5/java5-src/org | |
parent | 79d9aff324adce6ef480155be0db3db85a89092a (diff) | |
download | aspectj-db06666e1c5858bdc4e6fb0c43ec2d74efd649f2.tar.gz aspectj-db06666e1c5858bdc4e6fb0c43ec2d74efd649f2.zip |
Bug 150487 "Tracing and Logging Framework" (add JUnit tests)
Diffstat (limited to 'weaver5/java5-src/org')
-rw-r--r-- | weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java b/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java index 93d816d90..7847e6127 100644 --- a/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java +++ b/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.aspectj.weaver.tools; +import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; @@ -55,9 +56,26 @@ public class Jdk14Trace extends AbstractTrace { } } - @Override public boolean isTraceEnabled() { - return logger.isLoggable(Level.FINE); + return logger.isLoggable(Level.FINER); + } + + public void setTraceEnabled (boolean b) { + if (b) { + logger.setLevel(Level.FINER); + Handler[] handlers = logger.getHandlers(); + if (handlers.length == 0) { + Logger parent = logger.getParent(); + if (parent != null) handlers = parent.getHandlers(); + } + for (int i = 0; i < handlers.length; i++) { + Handler handler = handlers[i]; + handler.setLevel(Level.FINER); + } + } + else { + logger.setLevel(Level.INFO); + } } } |