I'm trying to log a login action with AspectJ. I need to obtain the logged user. I tried this but it doesn't work. The joinpoint is never executed.
@Aspect
public class LoginActivityAspect {
@Pointcut(value = "call(void com.android.project.activities.LoginActivity.loginSuccess(String)) && this(username)", argNames = "username")
public void loginSuccess(String username) {}
@Before(value = "loginSuccess(username)")
public void logLoginSuccess(username) {
logger.debug("loginSuccess", "Login success: " + username);
}
}
In LoginActivity I have this method:
public void loginSuccess(String username){
//DO STUFF
}
What am I doing wrong? Thanks.