title: Why is Mule exception strategy so chatty?
body: <p>In my Mule app, I've configured some of the flows to use a catch exception strategy in order to do some special processing. For these cases, I want to pop the error and the original payload into an object store. Everywhere else, the default exception strategy is fine.</p>
  
  <pre><code>&lt;flow name="saveLookup"&gt;
      &lt;vm:inbound-endpoint exchange-pattern="one-way"  ref="Lookup_Save_VM" /&gt;
      &lt;component&gt;
        &lt;spring-object bean="insertLookupMDCvalues"/&gt;
      &lt;/component&gt;
      &lt;set-variable variableName="originalPayload" value="#[payload]"/&gt;
      &lt;json:json-to-object-transformer returnClass="com.company.LookupData"/&gt;
      &lt;set-variable variableName="transactionId" value="#[payload.transactionId]"/&gt;
      &lt;transactional action="ALWAYS_BEGIN"&gt;
          &lt;logger message="${lookup.SQL}" level="INFO"/&gt;
          &lt;jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="saveLookup" queryTimeout="-1" connector-ref="JdbcConnector" /&gt;
          &lt;foreach collection="#[payload.transactional.lookupItems.items]"&gt;
              &lt;logger message="${lookup.item.SQL}" level="INFO" /&gt;
              &lt;jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="saveLookupItem" queryTimeout="-1" connector-ref="JdbcConnector"/&gt;
          &lt;/foreach&gt;
      &lt;/transactional&gt;
      &lt;component&gt;
        &lt;spring-object bean="clearLookupMDCvalues"/&gt;
      &lt;/component&gt;        
      &lt;catch-exception-strategy&gt;
          &lt;message-properties-transformer scope="invocation"&gt;
              &lt;add-message-property key="errorMap" value="#[['id' : transactionId, 'body' : originalPayload, 'error' : exception.summaryMessage]]"/&gt;
          &lt;/message-properties-transformer&gt;
          &lt;choice&gt;
              &lt;when expression="#[message.inboundProperties['resubmit']]"&gt;
                  &lt;logger message="Resubmission of lookup data failed, saving to Dead Letter object store. ID=#[transactionId]" level="INFO"/&gt;
                  &lt;objectstore:store config-ref="lookupDeadLetterOS" key="#[transactionId]" overwrite="true" value-ref="#[errorMap]"/&gt;
              &lt;/when&gt;
              &lt;otherwise&gt;
                  &lt;logger message="Saving lookup data failed, saving to Error object store. ID=#[transactionId]" level="INFO"/&gt;
                  &lt;objectstore:store config-ref="lookupErrorOS" key="#[transactionId]" overwrite="true" value-ref="#[errorMap]"/&gt;
              &lt;/otherwise&gt;
          &lt;/choice&gt;
          &lt;set-payload value="Error: #[exception.summaryMessage]"/&gt;
          &lt;component&gt;
            &lt;spring-object bean="clearLookupMDCvalues"/&gt;
          &lt;/component&gt;                 
      &lt;/catch-exception-strategy&gt;
  &lt;/flow&gt;
  </code></pre>
  
  <p>My problem is that when an error is encountered, let's say a Null Pointer Exception in the foreach component, I'm seeing four ERROR log statements for each event:</p>
  
  <ul>
  <li>Exception stack is: 1. null (java.lang.NullPointerException) <em>...and so on. This is logged twice.</em></li>
  <li>CatchMessagingExceptionStrategy - Message : Execution of the expression "payload.transactional.lookupItems.items" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: LookupData</li>
  <li>DefaultMessagingExceptionStrategy - Message : Execution of the expression "payload.transactional.lookupItems.items" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: LookupData</li>
  </ul>
  
  <p>I thought that a flow-specific exception strategy should override the default strategy. Why the duplicate log messages, and is there a way to shush them? I'd like to avoid having to configure the default exception strategy, as it's perfectly acceptable behavior in the majority of the flows.</p>