summaryrefslogtreecommitdiffstats
path: root/sandbox/rfeng/aop-logging/src/test/java/org/apache
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-08-06 16:19:39 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-08-06 16:19:39 +0000
commit9437a5e897404743bd05438357b175626425f850 (patch)
tree4af980ea29ca71c8cb98e3ed872fcbd296fcd526 /sandbox/rfeng/aop-logging/src/test/java/org/apache
parentdf92933f74b47ded6078f53ea80f054ab919ef04 (diff)
Display input/output for traces
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@683317 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/rfeng/aop-logging/src/test/java/org/apache')
-rw-r--r--sandbox/rfeng/aop-logging/src/test/java/org/apache/tuscany/sca/aspectj/MyTracingAspect.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/sandbox/rfeng/aop-logging/src/test/java/org/apache/tuscany/sca/aspectj/MyTracingAspect.java b/sandbox/rfeng/aop-logging/src/test/java/org/apache/tuscany/sca/aspectj/MyTracingAspect.java
index 7c04341718..3d70d03365 100644
--- a/sandbox/rfeng/aop-logging/src/test/java/org/apache/tuscany/sca/aspectj/MyTracingAspect.java
+++ b/sandbox/rfeng/aop-logging/src/test/java/org/apache/tuscany/sca/aspectj/MyTracingAspect.java
@@ -19,7 +19,9 @@
package org.apache.tuscany.sca.aspectj;
-import org.aspectj.lang.JoinPoint.StaticPart;
+import java.util.Arrays;
+
+import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
@@ -38,22 +40,38 @@ public class MyTracingAspect extends TracingAspect {
System.out.println("completeLog()");
}
- @Pointcut("execution(public * org.apache.tuscany.sca..*.*(..))")
+ @Pointcut("execution(public * org.apache.tuscany.sca..*.*(..)) &&!within(java..*)")
protected void entry() {
}
-
+
@Pointcut("within(org.apache.tuscany.sca..*) && !within(org.apache.tuscany.sca.aspectj.*Aspect)")
protected void withinScope() {
}
@Override
- protected void logEnter(StaticPart jp) {
+ protected void logEnter(JoinPoint jp) {
System.out.println("> " + jp.getSignature());
+ if (jp.getArgs().length != 0) {
+ System.out.println("Input: " + Arrays.asList(jp.getArgs()));
+ }
+ }
+
+ @Override
+ protected void logExit(JoinPoint jp) {
+ // System.out.println("> " + jp.getSignature());
+ }
+
+ @Override
+ protected void logException(JoinPoint jp, Throwable throwable) {
+ System.out.println("! " + jp.getSignature() + " " + throwable.getMessage());
}
@Override
- protected void logExit(StaticPart jp) {
+ protected void logExit(JoinPoint jp, Object result) {
System.out.println("< " + jp.getSignature());
+ if (!jp.getSignature().toString().startsWith("void ")) {
+ System.out.println("Output: " + result);
+ }
}
@Override