org.kuali.student.common.util
Class SimpleExceptionLoggingAdvice

java.lang.Object
  extended by org.kuali.student.common.util.SimpleExceptionLoggingAdvice
All Implemented Interfaces:
org.aopalliance.aop.Advice, AfterAdvice, ThrowsAdvice

public class SimpleExceptionLoggingAdvice
extends Object
implements ThrowsAdvice

Advice to log exceptions. Default loggingLevel=STACKTRACE and exceptionLoggingType=THROWABLE.

Spring configuration example

 <aop:config>
     <aop:aspect id="exceptionLoggingAspect" ref="exceptionLoggingAdvice" order="2">
         <aop:after-throwing
             pointcut="execution(* org.kuali.student.lum.lu.service.*.*(..))"
             method="afterThrowing" throwing="t" />
     </aop:aspect>
 </aop:config>
 <bean id="exceptionLoggingAdvice" class="org.kuali.student.common.util.SimpleExceptionLoggingAdvice">
     <property name="loggingLevel" value="INFO" />
     <property name="exceptionLoggingType" value="RUNTIME" />
 </bean>
 


Constructor Summary
SimpleExceptionLoggingAdvice()
          Constructor.
 
Method Summary
 void afterThrowing(org.aspectj.lang.JoinPoint jp, Throwable t)
          Catches the exception being thrown.
 void setExceptionLoggingType(String exceptionType)
          Sets the type of exception to log.
 void setLoggingLevel(String loggingLevel)
          Sets the logging level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleExceptionLoggingAdvice

public SimpleExceptionLoggingAdvice()
Constructor.

Method Detail

setLoggingLevel

public void setLoggingLevel(String loggingLevel)
Sets the logging level.

Logging levels:

Parameters:
loggingLevel - Logging level

setExceptionLoggingType

public void setExceptionLoggingType(String exceptionType)
Sets the type of exception to log. E.g. Only log runtime exception (RUNTIME).

Exception types:

Parameters:
exceptionType - exception logging type

afterThrowing

public void afterThrowing(org.aspectj.lang.JoinPoint jp,
                          Throwable t)
                   throws Throwable
Catches the exception being thrown.

Parameters:
jp - Aspect join point
t - Exception being thrown
Throws:
Throwable


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.