On 06/03/2008, davsclaus <[EMAIL PROTECTED]> wrote: > > Hi > > I have been working on some patches for camel-mina as we needed camel to > support synchronous TCP communication and the likes.
Great! > During unit testing I was fighting to output DEBUG logging using > log4j.properties. It took quite a while for me to figure out that log4j is > not picked up/used at all during unit testing since the pom.xml that are > used default in camel depends on: > > <dependency> > <groupId>commons-logging</groupId> > <artifactId>commons-logging-api</artifactId> > <version>1.0.4</version> > </dependency> FWIW the reason for this is that if you don't use the logging-api but use logging, it tends to shove in a forced dependency on avalon, logkit, log4j etc. > And apparently there is a difference when the artifcatid is -api > (commons-logging-api). The it does not include the Log4jFactory and then you > are stuck with lame JDK1.4 logging. > > > To remedy it I had to set this in the pom.xml in camel-mina component > > <dependency> > <groupId>commons-logging</groupId> > <artifactId>commons-logging</artifactId> > <scope>test</scope> > </dependency> > > This is the non -api version that includes the Log4jFactory and others. > Then the log4j.properties from test/resources is picked up and I can have > DEBUG logging from all the frameworks used (even Mina). > > Changing the uber pom.xml to use the non -api did not work AFAIR - there > were some maven build problems later on. I'm wondering if we should add the above dependency (a test scoped dependency of commons-logging) to the root pom.xml? > Is there a sane reason why JCL has this abstraction between the -api and non > api version where the most used logging framework is excluded? Yeah - see above :( No idea why it doesn't just use optional for the log4j/avalon stuff > I just wanted to raise this on this forum. How does the camel developers go > around this? I am sure there are others that have had similar problems. I often add commons-logging and log4j as test scopes in most components. But its kinda sucky - am sure we can do something better (e.g. maybe move those to root pom.xml?) We so need IDEs to support maven pom refactoring :) -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com
