Announcement Announcement Module
Collapse
No announcement yet.
IllegalArgumentException in CustomizableTraceInterceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • IllegalArgumentException in CustomizableTraceInterceptor

    Just want to point out a problem with the org.springframework.aop.interceptor.CustomizableTr aceInterceptor

    We used it the following way:
    Code:
    <bean id="loggingInterceptor"
     class="org.springframework.aop.interceptor.CustomizableTraceInterceptor">
    	<property name="enterMessage">
        	<value>$&#91;targetClassShortName&#93;.$&#91;methodName&#93;&#40;$&#91;arguments&#93;&#41; Types&#40;$&#91;argumentTypes&#93;&#41;</value>
    	</property>
    </bean>
    To log the values, passed into our business facade.
    The problem comes in with the the $[arguments] Placeholder. Passing a String containing a dollar sign $ throws a nice
    Code:
    java.lang.IllegalArgumentException&#58; Illegal group reference
    at java.util.regex.Matcher.appendReplacement&#40;Matcher.java&#58;554&#41;
    	at org.springframework.aop.interceptor.CustomizableTraceInterceptor.replacePlaceholders&#40;CustomizableTraceInterceptor.java&#58;321&#41;
    	at org.springframework.aop.interceptor.CustomizableTraceInterceptor.invokeUnderTrace&#40;CustomizableTraceInterceptor.java&#58;274&#41;
    	at org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke&#40;AbstractTraceInterceptor.java&#58;77&#41;
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed&#40;ReflectiveMethodInvocation.java&#58;144&#41;
    So we throwed the arguments out of the logging.
    Does anyone know about another solution? Are we doing something wrong here?
    Besides this error this aop style of logging simply rocks. So easy and yet so powerful. Besides this little flaw.

  • #2
    Karsten,

    Can you raise a JIRA issue for this and ask for it to be assigned to me. I'll put the fix in for 1.2.3.

    Rob

    Comment


    • #3
      Created a JIRA issue at SPR-1151. Issue is marked as resolved and the fix has been added to CVS.

      Rob

      Comment


      • #4
        thanx

        Rob,
        thx a lot for this quick fix. Sorry for not putting it in Jira so fast.
        I am amazed by the speed of your response. Thank you.
        Cheers,
        Karsten.

        Comment


        • #5
          Just downloaded the brand new 1.2.3 version. So I can confirm fix in Spring 1.2.3.
          Thx again.

          Comment


          • #6
            question for CustomizableTraceInterceptor

            I tried to follow the above example. And I tried to get exception error, I could not see degug or log message anywhere. How Can I make to get these message?

            I put the following def in ApplicationContext.xml

            <bean id="traceInterceptor" class="org.springframework.aop.interceptor.Customi zableTraceInterceptor">
            <property name="enterMessage">
            <value>$[targetClassShortName].$[methodName]($[arguments]) Types($[argumentTypes])</value>
            </property>
            <property name="exitMessage"><value>EXIT - {1}{2}</value></property>
            <property name="exceptionMessage"><value>EXIT - {1}{2}</value></property>
            </bean>

            <bean id="wbxml-builder" class="org.springframework.aop.framework.ProxyFact oryBean">
            <property name="proxyInterfaces"><value>xxx.r.builder.Builde r</value></property>
            <property name="interceptorNames">
            <list>
            <value>traceInterceptor</value>

            Please help me to get this log?

            Thanks,

            Kai

            Comment


            • #7
              Same problem with $[exception] placeholder remains in CustomizableTraceInterceptor. Strangely no one has been reported about it as sign '$' is quite frequently found in stack traces(e.g. in inner classes' names)

              Comment

              Working...
              X