Created
          September 15, 2011 04:52 
        
      - 
      
- 
        Save krams915/1218574 to your computer and use it in GitHub Desktop. 
    TraceInterceptor.java
  
        
  
    
      This file contains hidden or 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.tutorial.aop; | |
| import org.aopalliance.intercept.MethodInvocation; | |
| import org.apache.commons.logging.Log; | |
| import org.apache.log4j.Logger; | |
| import org.springframework.aop.interceptor.CustomizableTraceInterceptor; | |
| import org.springframework.core.annotation.Order; | |
| /** | |
| * 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