Skip to main content

Posts

Showing posts from September, 2011

Logging exceptions root cause first

The 0.9.30 release of Logback logging library brings new awesome feature: logging stack traces starting from root (innermost) exception rather than from the outermost one. Of course my excitement has nothing to do with the fact that I contributed this feature...



To paraphrase Cecil B. de Mille: “The way to make a blog post is to begin with a stack trace and work up to a climax” - here it goes:



The details aren't important yet, but from 100ft view you can see long stack trace with several exceptions wrapping each other (causing). We'll go back to this stack trace, but first some basics. If you throw an exception it will be logged in a way showing how the stack was looking in the moment when the exception was from. At the very bottom you will either see static main() or Thread.run() proceeded by methods invoked up to the first stack trace line indicating the place where the actual exception was thrown. This is very convenient since you can see the whole control flow that resulte…

The evolution of Spring dependency injection techniques

Looking back at the history of Spring framework you will find out that the number of ways you can implement dependency injection is growing in every release. If you've been working with this framework for more than a month you'll probably find nothing interesting in this retrospective article. Nothing hopefully except the last example in Scala, language that accidentally works great with Spring.
First there was XML [full source]:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd "> <bean id="foo" class="com.blogspot.nurkiewicz.Foo"> <property name="bar" ref="bar"/> <property name="jdbcOperati…