Announcement Announcement Module
Collapse
No announcement yet.
SimpleTraceInterceptor no console output Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleTraceInterceptor no console output

    Hi,

    i am trying to apply interceptors from spring framework like simpletraceinterceptor or PerformanceMonitorInterceptor and not getting any output statements in console or logs..if i use my own interceptor, then its working fine...any ideas...i tried log4j and commons logging in classpath but still dont see debug or tracing statemens in console or log file..i am using rational application developer for this tesing...any ideas what would be wrong..spring.xml as below



    <beans>
    <bean id="Adder1" class="springex.AdderImpl"/>
    <bean id="Adder2" class="springex.CopyImpl"/>
    <bean id="loggingInterceptor" class="pagecode.LoggingInterceptor"/>

    <bean id="performanceInterceptor" class="org.springframework.aop.interceptor.Perform anceMonitorInterceptor"/>
    <bean id="debugInterceptor" class="org.springframework.aop.interceptor.SimpleT raceInterceptor">
    <property name="useDynamicLogger"><value>true</value></property>
    </bean>
    <bean id="proxyCreator" class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
    <property name="beanNames">
    <value>*</value>
    </property>

    <property name="interceptorNames">
    <list>
    <value>debugInterceptor</value>
    <value>performanceInterceptor</value>
    </list>
    </property>
    </bean>
    </beans>
    Edit/Delete Message

  • #2
    Try adding the following to your log4j.xml file:

    Code:
    <logger name="org.springframework.aop.interceptor">
        <level value="DEBUG"/>
    </logger>

    Comment


    • #3
      thanks for the reply...my curren log4j.xml has the tag...i have logj-1.2.9.jar and log4j.xml in classpath...do i need to do anything more to view debug messages in console

      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
      <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
      <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern"
      value="%p - %C{1}.%M(%L) | %m%n"/>
      </layout>
      </appender>
      <logger name="org.springframework.aop.interceptor">
      <level value="DEBUG"/>
      </logger>
      <root>
      <level value="DEBUG"/>
      <appender-ref ref="CONSOLE"/>
      </root>
      </log4j:configuration>

      Comment


      • #4
        Is commons-logging.jar in your classpath? It's needed for Spring. Here's my log4j.xml:

        Code:
        <?xml version="1.0" encoding="UTF-8" ?>
        <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
        
        <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
        
            <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
                <layout class="org.apache.log4j.PatternLayout">
                    <param name="ConversionPattern"
                        value="%p - %C{1}.%M(%L) | %m%n"/>
                </layout>
            </appender>
        
            <logger name="org.apache">
                <level value="WARN"/>
            </logger>
        
            <logger name="net.sf.ehcache">
                <level value="WARN"/>
            </logger>
                
            <logger name="org.springframework">
                <level value="WARN"/>
            </logger>
            
            <logger name="org.springframework.aop.interceptor">
                <level value="DEBUG"/>
            </logger>
        
            <logger name="org.appfuse">
                <level value="DEBUG"/>
            </logger>
            <root>
                <level value="WARN"/>
                <appender-ref ref="CONSOLE"/>
            </root>
        
        </log4j:configuration>

        Comment


        • #5
          it was not there and i added it..still no luck...if i add my own interceptor, i get debug statements fine..not sure if its something to do with Rational application developer or classpath...i have log4j.xml, log4j.jar and commons-log.jar under web-inf/lib..is it ok ?

          Comment


          • #6
            below is the class where i am running the app

            public class SpringMain
            {

            public static void main(String[] args)
            {
            ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(new String[] {
            "springbeans.xml" });
            AdderImpl a = (AdderImpl) appContext.getBean("Adder1");
            System.out.println("adder = " + a);
            System.out.println("result = " + a.add(4, 7));

            CopyImpl a1 = (CopyImpl) appContext.getBean("Adder2");
            System.out.println("adder1 = " + a1);
            System.out.println("result = " + a1.add(4, 7));
            }
            }

            Comment


            • #7
              Your log4j.xml should be in your WEB-INF/classes directory. If that doesn't work - can you try running your application outside of Rational application developer? It is possible that another logj4.xml/log4j.properties file is overriding yours? I've seen this happen with a RC version of Acegi - it had a log4j.properties file in the root directory of the JAR.

              Comment


              • #8
                i tried running from command prompt but still no luck..below is my classpath and output results if i run from command prompt..using websphere application server jvm 1.5.0_06-b05...

                C:\temp\Spring>set CLASSPATH=C:\temp\Spring\Tut1\spring.jar;C:\temp\S pring\Tut1\
                log4j-1.2.9.jar;C:\temp\Spring\Tut1\commons-logging.jar;C:\temp\Spring;C:\temp\S
                pring\Tut1\cglib-nodep-2.1.jar

                C:\temp\Spring>C:\IBM\Portal51UTE\AppServer\java\b in\java springex.SpringMain
                INFO - XmlBeanDefinitionReader.loadBeanDefinitions(163) | Loading XML bean defin
                itions from class path resource [springbeans.xml]
                DEBUG - XmlBeanDefinitionReader.doLoadBeanDefinitions(219) | Using JAXP implemen
                tation [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@ 337370fb]
                DEBUG - AbstractBeanDefinitionReader.loadBeanDefinitions(1 47) | Loaded 5 bean de
                finitions from location pattern [springbeans.xml]
                adder = springex.AdderImpl@7ac6b0fa
                result = 11
                adder1 = springex.CopyImpl@66af0fb
                result = 11

                C:\temp\Spring>java -fullversion
                java full version "1.5.0_06-b05"

                Comment


                • #9
                  thanks....now i am getting output if i run from command prompt...will try to fix in IDE also...thanks much for the support...appreciate it

                  Comment


                  • #10
                    is there any way that we can configure these built in interceptors to use certain log4j.xml file instead of reading from different location...i am still not able to locate why or where its reading the log4j.xml...everything works fine from command promp but not from application server or rational application developer...

                    Comment

                    Working...
                    X