[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] (no subject)
|
aspectj-users,
as you can see, that is very simple aspect class.
I want to get logger from a method , but why it has a warnning?
package creatxr.util.aspect;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.SourceLocation;
public aspect LoggerAspect {
private Log getLogger(JoinPoint joinPoint) {
Log logger =
LogFactory.getLog(joinPoint.getStaticPart().getSourceLocation().getWithinType().getClass());
return logger;
}
pointcut exceptionLoggerMethods() : call (public
java.lang.Exception+.new(..))
&& !within(LoggerAspect);
before() : exceptionLoggerMethods() {
}
after() returning(Exception e) : exceptionLoggerMethods() {
SourceLocation src = thisJoinPointStaticPart.getSourceLocation();
Log logger = LogFactory.getLog(src.getWithinType());
logger.debug(e);
}
after() throwing(Exception e) : execution(* *.*(..)) {
//////////////////////// //Why warnning here ? how to correct?
getLogger(thisJoinPoint).debug(e);
}
}
Creatxr,creatxr@xxxxxxxxxxx
2006-4-16
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn