Results 1 to 4 of 4

Thread: Limiting log output on an afterThrowing

  1. #1
    Join Date
    Jun 2006
    Location
    Chiswick, London
    Posts
    3

    Default 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. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

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

  3. #3
    Join Date
    Jun 2006
    Location
    Chiswick, London
    Posts
    3

    Default

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

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •