Created
January 20, 2012 07:45
-
-
Save krams915/1646028 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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