Announcement Announcement Module
No announcement yet.
Limiting log output on an afterThrowing Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Limiting log output on an afterThrowing

    I have a simple log interceptor that basically collates some system details and the exception thats occured and emails these details to specified email addresses. However, when an exception occurs and is passed along an exception chain I recieve the log output and emails for each afterThrowing interception.

    How can i limit this occurance to just 1 instance? I don't want to use getCause() on the exception since I may lose exception tracing on essential external libraries that have been wrapped before it reaches my app.


  • #2
    I would assume that the advice is matching multiple times causing your problem. Is it possible to see the applicationContext.xml?


    • #3
      yes it is

      <bean id="autoProxy" class="org.springframework.aop.framework.autoproxy .DefaultAdvisorAutoProxyCreator"/>

      <!-- Pointcut -->
      <bean id="loggingPointcut" class=" thodPointcut">
      <property name="patterns">

      <!-- Advice -->
      <bean id="loggingInterceptor" class="com.something.whatever.util.logging.Logging Interceptor">
      <constructor-arg index="0">
      <ref local="loggingManagerConfig"/>
      <constructor-arg index="1">
      <ref local="mailManager"/>

      <!-- Advisor -->
      <bean id="loggingMonitor" class=" tcutAdvisor">
      <property name="advice">
      <ref local="loggingInterceptor"/>
      <property name="pointcut">
      <ref local="loggingPointcut"/>


      • #4
        If it's matching more than once then the way to fix it would be to make the expression more specific to only match once.