Announcement Announcement Module
Collapse
No announcement yet.
Limiting log output on an afterThrowing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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.

    Thanks
    D.

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

    Comment


    • #3
      yes it is

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

      <!-- Pointcut -->
      <bean id="loggingPointcut" class="org.springframework.aop.support.JdkRegexpMe thodPointcut">
      <property name="patterns">
      <list>
      <value>com.something.whatever.*</value>
      </list>
      </property>
      </bean>

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

      <!-- Advisor -->
      <bean id="loggingMonitor" class="org.springframework.aop.support.DefaultPoin tcutAdvisor">
      <property name="advice">
      <ref local="loggingInterceptor"/>
      </property>
      <property name="pointcut">
      <ref local="loggingPointcut"/>
      </property>
      </bean>
      ....

      Comment


      • #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.

        Comment

        Working...
        X