Tuesday, November 3, 2009
Windows vs Linux
Now I am working on windows again, I have come across the dreaded ^M (windows end of line character)... To strip these characters, on linux, open VI and type :1,$ s/{ctrl-V}{ctrl-M}//
Monday, November 2, 2009
Simple performance logging with Spring
We had a problem recently where a call/response to the server was taking 10 seconds. We needed to figure out where the delay was, and the perfect way to do that was using the Spring PerformanceMonitorInterceptor. With Spring 2.0, adding it is a breeze.
In the applicationContext.xml
and then in log4j.properties
We found the problem was not in the application, but with the dev server, which was not configured properly to resolve hosts...
In the applicationContext.xml
<bean id="timingLogger" class="org.springframework.aop.interceptor.PerformanceMonitorInterceptor">
<aop:aspectj-autoproxy>
<aop:config>
<aop:advisor pointcut="execution(* com.yourcompany.application.dao.*.*(..))" ref="timingLogger">
</aop:advisor>
</aop:config>
</aop:aspectj-autoproxy>
and then in log4j.properties
log4j.logger.org.springframework.aop.interceptor.PerformanceMonitorInterceptor=TRACE, stdouttrace
log4j.appender.stdouttrace=org.apache.log4j.ConsoleAppender
log4j.appender.stdouttrace.layout=org.apache.log4j.PatternLayout
log4j.appender.stdouttrace.layout.ConversionPattern=%m%n
We found the problem was not in the application, but with the dev server, which was not configured properly to resolve hosts...
Subscribe to:
Posts (Atom)