Project

General

Profile

1
package eu.dnetlib.enabling.tools;
2

    
3
import org.aopalliance.intercept.MethodInvocation;
4
import org.apache.commons.logging.Log;
5
import org.springframework.aop.interceptor.CustomizableTraceInterceptor;
6

    
7
/**
8
 * This class intercepts calls to the OAICore to measure its execution time. It uses Spring AOP.
9
 *
10
 * @author alessia
11
 */
12
public class LogInterceptor extends CustomizableTraceInterceptor {
13

    
14
	@Override
15
	protected void writeToLog(final Log logger, final String message, final Throwable ex) {
16
		if (ex != null) {
17
			logger.error(message, ex);
18
		} else {
19
			logger.debug(message);
20
		}
21
	}
22

    
23
	@Override
24
	protected boolean isInterceptorEnabled(final MethodInvocation invocation, final Log logger) {
25
		return true;
26
	}
27
}
(4-4/6)