spring aop 详细记录日志问题

spring aop 可以实现详细记录日志的功能吗?
如:记录方法执行时间、方法是否执行成功(是否有异常)、接收传参注释

当然可以

  1. applicationContext.xml里配置 [code="java"]

[/code]
2. 写一个切面类

[code="java"]

@Aspect
public class FourmAspect {

@Pointcut("execution(* *.*(..))")
public void a(){}

@Around("a()")
public void around1(ProceedingJoinPoint point) throws Throwable {
    System.out.println("before1.......");
    long before = System.currentTimeMillis();
    point.proceed();
    long after = System.currentTimeMillis();
    Object[] args = point.getArgs();
    System.out.println("before2.......");

    System.out.println("总共时间:"+(after - before)); }


@Before("a()")
public void before1(){
    System.out.println("before........");
}


@AfterThrowing("a()")
public void throws1(){
    System.out.println("有异常......");
}

}

[/code]

当然可以的!

zouruixin 说的正解,其实我也现学现用的...

必须可以,我最近刚做了一个,并且如果记录日志的程序本身出错了,不会对整个系统的运行造成影响,并且可以和业务系统松偶和的

真的可以吗,能做到a调用b,b调用c吗,有难度。