Skip to content

Instantly share code, notes, and snippets.

@krams915
Created January 20, 2012 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save krams915/1646028 to your computer and use it in GitHub Desktop.
Save krams915/1646028 to your computer and use it in GitHub Desktop.
package org.krams.aop;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.log4j.Logger;
import org.springframework.aop.interceptor.CustomizableTraceInterceptor;
/**
* Extends {@link CustomizableTraceInterceptor} to provide custom logging levels
*/
public class TraceInterceptor extends CustomizableTraceInterceptor {
private static final long serialVersionUID = 287162721460370957L;
protected static Logger logger4J = Logger.getLogger("aop");
@Override
protected void writeToLog(Log logger, String message, Throwable ex) {
if (ex != null) {
logger4J.debug(message, ex);
} else {
logger4J.debug(message);
}
}
@Override
protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger) {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment