i4way-dash/.svn/pristine/b7/b799cfd4f8669e51da3abe1a054...

33 lines
1.0 KiB
Plaintext

package kr.co.i4way.common.logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class LoggerAspect {
protected Log log = LogFactory.getLog(LoggerAspect.class);
static String name = "";
static String type = "";
@Around("execution(* kr.co.i4way..controller.*Controller.*(..)) or execution(* kr.co.i4way..service.*Impl.*(..)) or execution(* kr.co.i4way..dao.*DAO.*(..))")
public Object logPrint(ProceedingJoinPoint joinPoint) throws Throwable {
type = joinPoint.getSignature().getDeclaringTypeName();
if (type.indexOf("Controller") > -1) {
name = "Controller \t: ";
}
else if (type.indexOf("Service") > -1) {
name = "ServiceImpl \t: ";
}
else if (type.indexOf("DAO") > -1) {
name = "DAO \t\t: ";
}
log.debug(name + type + "." + joinPoint.getSignature().getName() + "()");
return joinPoint.proceed();
}
}